@@ -57,10 +57,10 @@ |
||
| 57 | 57 | |
| 58 | 58 | foreach ($this->xml->order->items->item as $item) { |
| 59 | 59 | $orderItem = new Item(); |
| 60 | - $orderItem->setBarcode((string)$item['barcode']) |
|
| 61 | - ->setQuantity((int)$item['quantity']) |
|
| 60 | + $orderItem->setBarcode((string) $item['barcode']) |
|
| 61 | + ->setQuantity((int) $item['quantity']) |
|
| 62 | 62 | ->setReturn(boolval($item['returns'])) |
| 63 | - ->setRetprice((float)$item['retprice']); |
|
| 63 | + ->setRetprice((float) $item['retprice']); |
|
| 64 | 64 | $this->items[] = $orderItem; |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -43,8 +43,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |