Skip to content

Commit

Permalink
Attempt to be more PSR12 comply
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitexus committed Oct 5, 2023
1 parent 87bc293 commit 9afee1c
Show file tree
Hide file tree
Showing 12 changed files with 120 additions and 110 deletions.
25 changes: 14 additions & 11 deletions src/AbraFlexi/Adresar.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<?php

declare(strict_types=1);

/**
* AbraFlexi - Objekt adresáře.
*
* @author Vítězslav Dvořák <vitex@arachne.cz>
* @copyright (C) 2015-2023 Spoje.Net
*/
declare(strict_types=1);

namespace AbraFlexi;

Expand All @@ -16,7 +15,8 @@
*
* @link https://demo.flexibee.eu/c/demo/adresar/properties položky evidence
*/
class Adresar extends RW {
class Adresar extends RW
{

use stitky;
use subItems;
Expand All @@ -32,10 +32,11 @@ class Adresar extends RW {

/**
* get Email address for Customer with primary contact prefered
*
*
* @return string email of primary contact or address email or null
*/
public function getNotificationEmailAddress() {
public function getNotificationEmailAddress()
{
$email = null;
$emailsRaw = $this->getFlexiData($this->getApiURL(),
['detail' => 'custom:id,email,kontakty(primarni,email)', 'relations' => 'kontakty']);
Expand All @@ -61,7 +62,8 @@ public function getNotificationEmailAddress() {
*
* @return string cell phone number of primary contact or address cell number or null
*/
public function getCellPhoneNumber() {
public function getCellPhoneNumber()
{
$mobil = null;
$mobilsRaw = $this->getFlexiData($this->getApiURL(),
['detail' => 'custom:id,mobil,kontakty(primarni,mobil)', 'relations' => 'kontakty']);
Expand All @@ -87,7 +89,8 @@ public function getCellPhoneNumber() {
*
* @return string phone number of primary contact or address's phone number or null
*/
public function getAnyPhoneNumber() {
public function getAnyPhoneNumber()
{
$phoneNo = null;
$numbersRaw = $this->getFlexiData($this->getApiURL(),
['detail' => 'custom:id,mobil,tel,kontakty(primarni,mobil,tel)', 'relations' => 'kontakty']);
Expand All @@ -107,7 +110,7 @@ public function getAnyPhoneNumber() {
if (strlen(trim($kontakt['mobil']))) {
$phoneNo = $kontakt['mobil'];
break;
}
}
}
}

Expand All @@ -132,12 +135,12 @@ public function getAnyPhoneNumber() {
*
* @return array bank account details
*/
public function getBankAccountNumber($address = null) {
public function getBankAccountNumber($address = null)
{
if (is_null($address)) {
$address = $this->getMyKey();
}
$bucRaw = $this->getColumnsFromAbraFlexi(['buc', 'smerKod'], ['firma' => $address, 'evidence' => 'adresar-bankovni-ucet']);
return (!empty($bucRaw) && array_key_exists(0, $bucRaw)) ? $bucRaw : [];
}

}
}
26 changes: 14 additions & 12 deletions src/AbraFlexi/Banka.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* AbraFlexi - Bank Class.
* Objekt Banky.
Expand All @@ -10,6 +8,8 @@
* @copyright (C) 2015-2023 Spoje.Net
*/

declare(strict_types=1);

namespace AbraFlexi;

use AbraFlexi\firma;
Expand All @@ -19,11 +19,11 @@

/**
* Banka
*
*
* @link https://demo.flexibee.eu/c/demo/banka/properties Vlastnosti evidence
*/
class Banka extends RW implements \AbraFlexi\Document {

class Banka extends RW implements \AbraFlexi\Document
{
use stitky;
use firma;
use email;
Expand All @@ -49,7 +49,8 @@ class Banka extends RW implements \AbraFlexi\Document {
*
* @return boolean
*/
public function stahnoutVypisyOnline() {
public function stahnoutVypisyOnline()
{
$this->pullMode = true;
$this->performRequest('nacteni-vypisu-online.json', 'PUT', 'txt');
$this->pullMode = false;
Expand All @@ -63,25 +64,26 @@ public function stahnoutVypisyOnline() {
*
* @return array
*/
public function rawJsonToArray($rawJson) {
public function rawJsonToArray($rawJson)
{
return $this->pullMode ? explode($rawJson, "\n") : parent::rawJsonToArray($rawJson);
}

/**
* Start invoice automatic matching process ( it takes longer time )
* Spustí proces automatického párování plateb. ( trvá delší dobu )
*
* @link https://demo.flexibee.eu/devdoc/parovani-plateb Interní dokumentace
*
*
* @param boolean $advanced Use Advanced matching method ?
* @param string $filter Filter bank records before pairing ?
*
*
* @return boolean
*/
public function automatickeParovani($advanced = false, $filter = null) {
public function automatickeParovani($advanced = false, $filter = null)
{
$filterUrl = $filter === null ? "" : rtrim($filter, '/') . '/';
$this->performRequest($filterUrl . 'automaticke-parovani' . ($advanced ? '-pokrocile' : '' ), 'PUT');
return $this->lastResponseCode == 200;
}

}
9 changes: 4 additions & 5 deletions src/AbraFlexi/Cenik.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* AbraFlexi - Pricelist class.
* Objekt ceníku.
Expand All @@ -10,6 +8,8 @@
* @copyright (C) 2016-2017 Spoje.Net
*/

declare(strict_types=1);

namespace AbraFlexi;

use AbraFlexi\RW;
Expand All @@ -21,8 +21,8 @@
*
* @link https://demo.flexibee.eu/c/demo/cenik/properties Vlastnosti evidence
*/
class Cenik extends RW {

class Cenik extends RW
{
use stitky;
use subItems;
use getChanges;
Expand All @@ -33,5 +33,4 @@ class Cenik extends RW {
* @var string
*/
public $evidence = 'cenik';

}
Loading

0 comments on commit 9afee1c

Please sign in to comment.