Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
57.14% |
4 / 7 |
|
75.00% |
3 / 4 |
CRAP | |
0.00% |
0 / 1 |
Order | |
57.14% |
4 / 7 |
|
75.00% |
3 / 4 |
5.26 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getOrderLineList | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
addOrderLine | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace Apie\IntegrationTests\Apie\TypeDemo\Resources; |
4 | |
5 | use Apie\Core\Attributes\Description; |
6 | use Apie\Core\Attributes\FakeCount; |
7 | use Apie\Core\Attributes\RemovalCheck; |
8 | use Apie\Core\Attributes\StaticCheck; |
9 | use Apie\Core\Entities\EntityInterface; |
10 | use Apie\IntegrationTests\Apie\TypeDemo\Entities\OrderLine; |
11 | use Apie\IntegrationTests\Apie\TypeDemo\Enums\OrderStatus; |
12 | use Apie\IntegrationTests\Apie\TypeDemo\Identifiers\OrderIdentifier; |
13 | use Apie\IntegrationTests\Apie\TypeDemo\Lists\OrderLineList; |
14 | |
15 | #[RemovalCheck(new StaticCheck())] |
16 | #[FakeCount(1)] |
17 | #[Description('An order is a web order and consists of multiple order lines')] |
18 | class Order implements EntityInterface |
19 | { |
20 | private OrderIdentifier $id; |
21 | |
22 | private OrderStatus $orderStatus; |
23 | |
24 | public function __construct(private OrderLineList $orderLineList) |
25 | { |
26 | $this->id = new OrderIdentifier(null); |
27 | $this->orderStatus = OrderStatus::DRAFT; |
28 | } |
29 | |
30 | public function getId(): OrderIdentifier |
31 | { |
32 | return $this->id; |
33 | } |
34 | |
35 | public function getOrderLineList(): OrderLineList |
36 | { |
37 | return $this->orderLineList; |
38 | } |
39 | |
40 | public function addOrderLine(OrderLine $orderLine): Order |
41 | { |
42 | $this->orderStatus->ensureDraft(); |
43 | $this->orderLineList[] = $orderLine; |
44 | |
45 | return $this; |
46 | } |
47 | } |