| Conditions | 4 |
| Paths | 8 |
| Total Lines | 30 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | public function buildData() |
||
| 18 | { |
||
| 19 | $return = [ |
||
| 20 | '@amount' => $this->requestTransfer->getShoppingBasket()->getAmount(), |
||
| 21 | '@currency' => $this->requestTransfer->getShoppingBasket()->getCurrency(), |
||
| 22 | 'items' => [], |
||
| 23 | ]; |
||
| 24 | |||
| 25 | if ($this->requestTransfer->getShoppingBasket()->getShippingUnitPrice()) { |
||
| 26 | $return['shipping'] = [ |
||
| 27 | '@unit-price-gross' => $this->requestTransfer->getShoppingBasket()->getShippingUnitPrice(), |
||
| 28 | '@tax-rate' => $this->requestTransfer->getShoppingBasket()->getShippingTaxRate(), |
||
| 29 | '#' => $this->requestTransfer->getShoppingBasket()->getShippingTitle(), |
||
| 30 | ]; |
||
| 31 | } |
||
| 32 | |||
| 33 | if ($this->requestTransfer->getShoppingBasket()->getDiscountUnitPrice()) { |
||
| 34 | $return['discount'] = [ |
||
| 35 | '@unit-price-gross' => $this->requestTransfer->getShoppingBasket()->getDiscountUnitPrice(), |
||
| 36 | '@tax-rate' => $this->requestTransfer->getShoppingBasket()->getDiscountTaxRate(), |
||
| 37 | '#' => $this->requestTransfer->getShoppingBasket()->getDiscountTitle(), |
||
| 38 | ]; |
||
| 39 | } |
||
| 40 | |||
| 41 | $items = $this->requestTransfer->getShoppingBasket()->getItems()->getArrayCopy(); |
||
| 42 | foreach (array_keys($items) as $itemNumber) { |
||
| 43 | $return['items'][] = (new ShoppingBasketItem($this->requestTransfer, $itemNumber)); |
||
| 44 | } |
||
| 45 | |||
| 46 | return $return; |
||
| 47 | } |
||
| 57 |