| Total Complexity | 5 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | final class CartUseCase |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var CartRepository |
||
| 16 | */ |
||
| 17 | private $repository; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var Prices |
||
| 21 | */ |
||
| 22 | private $prices; |
||
| 23 | |||
| 24 | 2 | public function __construct(CartRepository $repository, Prices $prices) |
|
| 28 | 2 | } |
|
| 29 | |||
| 30 | 1 | public function add(string $cartId, string $productId, int $amount): void |
|
| 35 | 1 | } |
|
| 36 | |||
| 37 | 1 | public function detail(string $cartId): CartDetail |
|
| 38 | { |
||
| 39 | 1 | return $this->get($cartId)->calculate($this->prices); |
|
| 40 | } |
||
| 41 | |||
| 42 | 1 | private function get(string $cartId): Cart |
|
| 48 | } |
||
| 49 | } |
||
| 52 |