@@ -35,8 +35,9 @@ discard block |
||
35 | 35 | */ |
36 | 36 | protected function processAttributeNameAndValue($mainElement, $attributeName, $attributeValue): void |
37 | 37 | { |
38 | - if (empty($attributeValue)) |
|
39 | - return; |
|
38 | + if (empty($attributeValue)) { |
|
39 | + return; |
|
40 | + } |
|
40 | 41 | if (is_array($attributeValue)) { |
41 | 42 | $this->addValueAsArray($mainElement, $attributeName, $attributeValue); |
42 | 43 | } elseif (is_object($attributeValue)) { |
@@ -69,8 +70,9 @@ discard block |
||
69 | 70 | protected function addValueAsObject($mainElement, $attributeValue) |
70 | 71 | { |
71 | 72 | $newXmlObject = $mainElement->addChild($attributeValue->getAsXmlObject()->getName()); |
72 | - foreach ($attributeValue->getAsXmlObject()->children() as $child) |
|
73 | - $newXmlObject->addChild($child->getName(), $child); |
|
73 | + foreach ($attributeValue->getAsXmlObject()->children() as $child) { |
|
74 | + $newXmlObject->addChild($child->getName(), $child); |
|
75 | + } |
|
74 | 76 | } |
75 | 77 | |
76 | 78 | /** |
@@ -81,8 +83,9 @@ discard block |
||
81 | 83 | */ |
82 | 84 | protected function addValueAsString(SimpleXMLElement $mainElement, $attributeName, $attributeValue): void |
83 | 85 | { |
84 | - if (empty($attributeValue)) |
|
85 | - return; |
|
86 | + if (empty($attributeValue)) { |
|
87 | + return; |
|
88 | + } |
|
86 | 89 | if ($attributeName === 'title') { |
87 | 90 | $mainElement[0] = $attributeValue; |
88 | 91 | } elseif (substr($attributeName, 0, 1) === '_') { |
@@ -8,8 +8,8 @@ |
||
8 | 8 | class EmptyTokenException extends ErrorException |
9 | 9 | { |
10 | 10 | |
11 | - public function __construct($message = "", $code = 0, $severity = 1, $filename = __FILE__, $lineno = __LINE__, $previous = null) |
|
12 | - { |
|
13 | - parent::__construct('Dalli Service auth token is empty.', $code, $severity, $filename, $lineno, $previous); |
|
14 | - } |
|
11 | + public function __construct($message = "", $code = 0, $severity = 1, $filename = __FILE__, $lineno = __LINE__, $previous = null) |
|
12 | + { |
|
13 | + parent::__construct('Dalli Service auth token is empty.', $code, $severity, $filename, $lineno, $previous); |
|
14 | + } |
|
15 | 15 | } |
@@ -34,8 +34,9 @@ |
||
34 | 34 | */ |
35 | 35 | public function __construct(string $dalliEndpoint, ?string $authToken, ClientInterface $client = null) |
36 | 36 | { |
37 | - if (empty($authToken)) |
|
38 | - throw new EmptyTokenException(); |
|
37 | + if (empty($authToken)) { |
|
38 | + throw new EmptyTokenException(); |
|
39 | + } |
|
39 | 40 | |
40 | 41 | $this->client = $client ?? new Client(); |
41 | 42 | $this->dalliEndpoint = $dalliEndpoint; |
@@ -54,8 +54,9 @@ |
||
54 | 54 | $apiBody->add($order); |
55 | 55 | |
56 | 56 | $success = !$dalliClient->sendApiRequest($apiBody); |
57 | -if (!$success) |
|
57 | +if (!$success) { |
|
58 | 58 | foreach ($dalliClient->getErrors() as $error) |
59 | 59 | echo $error; |
60 | +} |
|
60 | 61 | |
61 | 62 | echo $dalliClient->getResponseBody(); |
@@ -12,8 +12,9 @@ |
||
12 | 12 | |
13 | 13 | $success = $dalliClient->sendApiRequest($apiBody); |
14 | 14 | |
15 | -if (!$success) |
|
15 | +if (!$success) { |
|
16 | 16 | foreach ($dalliClient->getErrors() as $error) |
17 | 17 | echo $error; |
18 | +} |
|
18 | 19 | |
19 | 20 | echo $dalliClient->getResponseBody(); |
@@ -26,8 +26,9 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function __construct(?string $apiMethodName, ?array $params = []) |
28 | 28 | { |
29 | - if (empty($apiMethodName)) |
|
30 | - throw new EmptyApiMethodException(); |
|
29 | + if (empty($apiMethodName)) { |
|
30 | + throw new EmptyApiMethodException(); |
|
31 | + } |
|
31 | 32 | |
32 | 33 | $this->apiMethodName = $apiMethodName; |
33 | 34 | $this->mainElement = new SimpleXMLElement("<$this->apiMethodName></$this->apiMethodName>"); |
@@ -38,8 +39,9 @@ discard block |
||
38 | 39 | |
39 | 40 | private function parseParamsToXml(): void |
40 | 41 | { |
41 | - if (empty($this->params)) |
|
42 | - return; |
|
42 | + if (empty($this->params)) { |
|
43 | + return; |
|
44 | + } |
|
43 | 45 | $this->addParamArrayToElement($this->mainElement, $this->params); |
44 | 46 | } |
45 | 47 |
@@ -4,7 +4,7 @@ |
||
4 | 4 | namespace floor12\DalliApi\Enum; |
5 | 5 | |
6 | 6 | |
7 | - class SimpleEnum |
|
7 | + class SimpleEnum |
|
8 | 8 | { |
9 | 9 | /** @var array */ |
10 | 10 | public static $list = []; |
@@ -13,9 +13,10 @@ |
||
13 | 13 | |
14 | 14 | $success = $dalliClient->sendApiRequest($apiBody); |
15 | 15 | |
16 | -if (!$success) |
|
16 | +if (!$success) { |
|
17 | 17 | foreach ($dalliClient->getErrors() as $error) |
18 | 18 | echo $error; |
19 | +} |
|
19 | 20 | |
20 | 21 | $dispatcher = new OrderStatusDispatcher($dalliClient->getResponseBody()); |
21 | 22 |
@@ -46,8 +46,9 @@ discard block |
||
46 | 46 | $itemsCount = sizeof($matches[0]); |
47 | 47 | for ($i = 0; $i < $itemsCount; $i++) { |
48 | 48 | $barcode = $matches[1][$i]; |
49 | - if (empty($barcode)) |
|
50 | - continue; |
|
49 | + if (empty($barcode)) { |
|
50 | + continue; |
|
51 | + } |
|
51 | 52 | $return = boolval($matches[2][$i]); |
52 | 53 | $this->items[$barcode] = (new Item()) |
53 | 54 | ->setBarcode($barcode) |
@@ -62,8 +63,9 @@ discard block |
||
62 | 63 | */ |
63 | 64 | public function isItemReturned($barcode): ?bool |
64 | 65 | { |
65 | - if (isset($this->items[$barcode])) |
|
66 | - return $this->items[$barcode]->isReturned(); |
|
66 | + if (isset($this->items[$barcode])) { |
|
67 | + return $this->items[$barcode]->isReturned(); |
|
68 | + } |
|
67 | 69 | return null; |
68 | 70 | } |
69 | 71 |