Skip to content

Commit be188de

Browse files
committed
cart to legacy layer
1 parent 4034806 commit be188de

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

depfile.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ layers:
66
collectors:
77
- type: className
88
regex: ^Bavix\\.*Legacy$
9+
- type: className
10+
regex: ^Bavix\\.*\\Objects\\Cart$
911

1012
- name: Contract
1113
collectors:
@@ -202,8 +204,10 @@ ruleset:
202204

203205
Legacy:
204206
- AssemblerDtoInterface
207+
- InternalException
205208
- ServiceInterface
206209
- DtoInterface
207210
- UIException
208211
- Contract
209212
- Model
213+
- Dto # Cart from objects

src/Objects/Cart.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
use Bavix\Wallet\Internal\Dto\BasketDto;
1212
use Bavix\Wallet\Internal\Dto\BasketDtoInterface;
1313
use Bavix\Wallet\Internal\Dto\ItemDto;
14+
use Bavix\Wallet\Internal\Dto\ItemDtoInterface;
1415
use Bavix\Wallet\Internal\Exceptions\CartEmptyException;
1516
use Bavix\Wallet\Internal\Exceptions\ExceptionInterface;
1617
use Bavix\Wallet\Internal\Service\MathServiceInterface;
17-
use Bavix\Wallet\Services\CastService;
18+
use Bavix\Wallet\Services\CastServiceInterface;
1819
use function count;
1920
use Countable;
2021
use function get_class;
@@ -31,12 +32,12 @@ final class Cart implements Countable, CartInterface
3132

3233
private array $meta = [];
3334

34-
private CastService $castService;
35+
private CastServiceInterface $castService;
3536

3637
private MathServiceInterface $math;
3738

3839
public function __construct(
39-
CastService $castService,
40+
CastServiceInterface $castService,
4041
MathServiceInterface $math
4142
) {
4243
$this->castService = $castService;
@@ -117,7 +118,7 @@ public function getQuantity(Product $product): int
117118
public function getBasketDto(): BasketDtoInterface
118119
{
119120
$items = array_map(
120-
fn (Product $product): ItemDto => new ItemDto($product, $this->getQuantity($product)),
121+
fn (Product $product): ItemDtoInterface => new ItemDto($product, $this->getQuantity($product)),
121122
$this->getUniqueItems()
122123
);
123124

0 commit comments

Comments
 (0)