| @@ 82-91 (lines=10) @@ | ||
| 79 | /** |
|
| 80 | * Get total cost of all items (VAT excluded) |
|
| 81 | */ |
|
| 82 | public function getTotalUnitCost(): Amount |
|
| 83 | { |
|
| 84 | return array_reduce( |
|
| 85 | $this->getItems(), |
|
| 86 | function (Amount $carry, ItemEnvelope $item) { |
|
| 87 | return $carry->add($item->getTotalUnitCost()); |
|
| 88 | }, |
|
| 89 | new Amount('0') |
|
| 90 | ); |
|
| 91 | } |
|
| 92 | ||
| 93 | /** |
|
| 94 | * Get total VAT cost for all items |
|
| @@ 96-105 (lines=10) @@ | ||
| 93 | /** |
|
| 94 | * Get total VAT cost for all items |
|
| 95 | */ |
|
| 96 | public function getTotalVatCost(): Amount |
|
| 97 | { |
|
| 98 | return array_reduce( |
|
| 99 | $this->getItems(), |
|
| 100 | function (Amount $carry, ItemEnvelope $item) { |
|
| 101 | return $carry->add($item->getTotalVatCost()); |
|
| 102 | }, |
|
| 103 | new Amount('0') |
|
| 104 | ); |
|
| 105 | } |
|
| 106 | ||
| 107 | /** |
|
| 108 | * Get total cost of all items (VAT included) |
|