| Total Complexity | 6 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types = 1); |
||
| 5 | class Cart |
||
| 6 | { |
||
| 7 | |||
| 8 | /** @var CartItem[] */ |
||
| 9 | private $items = []; |
||
| 10 | |||
| 11 | /** @var Currency */ |
||
| 12 | private $currency; |
||
| 13 | |||
| 14 | 2 | public function __construct(Currency $currency) |
|
| 15 | { |
||
| 16 | 2 | $this->currency = $currency; |
|
| 17 | 2 | } |
|
| 18 | |||
| 19 | 2 | public function addItem(string $name, int $quantity, int $amount, ?string $description = null): void |
|
| 20 | { |
||
| 21 | 2 | $this->items[] = new CartItem($name, $quantity, $amount, $description); |
|
| 22 | 2 | } |
|
| 23 | |||
| 24 | /** |
||
| 25 | * @return CartItem[] |
||
| 26 | */ |
||
| 27 | 1 | public function getItems(): array |
|
| 30 | } |
||
| 31 | |||
| 32 | 1 | public function getCurrentPrice(): Price |
|
| 37 | ); |
||
| 38 | } |
||
| 39 | |||
| 40 | 1 | private function countTotalAmount(): int |
|
| 49 | } |
||
| 50 | |||
| 52 |