Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
10 / 10 |
|
100.00% |
6 / 6 |
CRAP | |
100.00% |
1 / 1 |
| SqliteBasket | |
100.00% |
10 / 10 |
|
100.00% |
6 / 6 |
7 | |
100.00% |
1 / 1 |
| setPdo | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| create | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 | |||
| applyOffer | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| add | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| remove | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getItems | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Alistaircol\Hta\Domain\Basket; |
| 6 | |
| 7 | use Alistaircol\Hta\Domain\Basket\Concerns\BasketInterface; |
| 8 | use Alistaircol\Hta\Domain\Basket\Concerns\OfferInterface; |
| 9 | use Alistaircol\Hta\Domain\Basket\Concerns\ProductInterface; |
| 10 | use Alistaircol\Hta\Domain\Basket\DataTransferObjects\ProductInterfaceCollection; |
| 11 | use DomainException; |
| 12 | use PDO; |
| 13 | |
| 14 | class SqliteBasket extends AbstractBasket |
| 15 | { |
| 16 | protected PDO $pdo; |
| 17 | |
| 18 | public function setPdo(PDO $pdo) |
| 19 | { |
| 20 | $this->pdo = $pdo; |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * Create a new empty basket with optional offer. |
| 25 | * |
| 26 | * @param OfferInterface|null $offer |
| 27 | * @return BasketInterface |
| 28 | */ |
| 29 | public function create(?OfferInterface $offer = null): BasketInterface |
| 30 | { |
| 31 | $this->items = new ProductInterfaceCollection(); |
| 32 | |
| 33 | if ($offer instanceof OfferInterface) { |
| 34 | $this->applyOffer($offer); |
| 35 | } |
| 36 | |
| 37 | return $this; |
| 38 | } |
| 39 | |
| 40 | public function applyOffer(OfferInterface $offer): BasketInterface |
| 41 | { |
| 42 | throw new DomainException('Not implemented'); |
| 43 | } |
| 44 | |
| 45 | public function add(ProductInterface $product): BasketInterface |
| 46 | { |
| 47 | parent::add($product); |
| 48 | |
| 49 | throw new DomainException('Not implemented'); |
| 50 | } |
| 51 | |
| 52 | public function remove(ProductInterface $product): BasketInterface |
| 53 | { |
| 54 | throw new DomainException('Not implemented'); |
| 55 | } |
| 56 | |
| 57 | public function getItems(): ProductInterfaceCollection |
| 58 | { |
| 59 | throw new DomainException('Not implemented'); |
| 60 | } |
| 61 | } |