Test Failed
Push — master ( 61a68c...8715ef )
by Evgenii
09:40
created
src/Models/BaseXmlObject.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,8 +35,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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) === '_') {
Please login to merge, or discard this patch.
src/Exceptions/EmptyTokenException.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/DalliClient.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,9 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
examples/SendOrdersToCart.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
examples/ClearBasket.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,8 +12,9 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
src/Enum/SimpleEnum.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
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 = [];
Please login to merge, or discard this patch.
examples/GetOrderStatus.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,9 +13,10 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Enum/PayType.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@
 block discarded – undo
11 11
     const NO = 'NO';
12 12
 
13 13
     public static $list = [
14
-      self::CASH => 'Наличными',
15
-      self::CARD => 'Картой',
16
-      self::NO => 'Без оплаты',
14
+        self::CASH => 'Наличными',
15
+        self::CARD => 'Картой',
16
+        self::NO => 'Без оплаты',
17 17
     ];
18 18
 }
Please login to merge, or discard this patch.
src/OrderStatusDispatcher.php 2 patches
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,8 +43,9 @@  discard block
 block discarded – undo
43 43
     public function __construct(string $xmlBody)
44 44
     {
45 45
         $this->xml = simplexml_load_string($xmlBody);
46
-        if ($this->xml === false)
47
-            throw new Exception('XML body is not valid.');
46
+        if ($this->xml === false) {
47
+                    throw new Exception('XML body is not valid.');
48
+        }
48 49
         if ($this->xml->order) {
49 50
 
50 51
             foreach ($this->xml->order->statushistory->status as $statusItem) {
@@ -72,8 +73,9 @@  discard block
 block discarded – undo
72 73
      */
73 74
     public function isItemReturned($barcode): ?bool
74 75
     {
75
-        if (isset($this->items[$barcode]))
76
-            return $this->items[$barcode]->isReturned();
76
+        if (isset($this->items[$barcode])) {
77
+                    return $this->items[$barcode]->isReturned();
78
+        }
77 79
         return null;
78 80
     }
79 81
 
@@ -87,8 +89,9 @@  discard block
 block discarded – undo
87 89
 
88 90
     public function getStatusName(): ?string
89 91
     {
90
-        if ($this->getStatusId())
91
-            DalliOrderStatus::getLabel($this->getStatusId());
92
+        if ($this->getStatusId()) {
93
+                    DalliOrderStatus::getLabel($this->getStatusId());
94
+        }
92 95
         return null;
93 96
     }
94 97
 
@@ -112,8 +115,9 @@  discard block
 block discarded – undo
112 115
     {
113 116
         $returned = [];
114 117
         foreach ($this->items as $item) {
115
-            if ($item->isReturned())
116
-                $returned[] = $item;
118
+            if ($item->isReturned()) {
119
+                            $returned[] = $item;
120
+            }
117 121
         }
118 122
         return $returned;
119 123
     }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,10 +56,10 @@
 block discarded – undo
56 56
 
57 57
             foreach ($this->xml->order->items->item as $item) {
58 58
                 $orderItem = new Item();
59
-                $orderItem->setBarcode((string)$item['barcode'])
60
-                    ->setQuantity((int)$item['quantity'])
59
+                $orderItem->setBarcode((string) $item['barcode'])
60
+                    ->setQuantity((int) $item['quantity'])
61 61
                     ->setReturn(boolval($item['returns']))
62
-                    ->setRetprice((float)$item['retprice']);
62
+                    ->setRetprice((float) $item['retprice']);
63 63
                 $this->items[$orderItem->_barcode] = $orderItem;
64 64
             }
65 65
         }
Please login to merge, or discard this patch.