Total Complexity | 6 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
9 | final class ItemsResponse |
||
10 | { |
||
11 | /** @var array|Item[] */ |
||
12 | private $items; |
||
13 | |||
14 | private function __construct(array $itemsList) |
||
15 | { |
||
16 | $this->items = $itemsList; |
||
17 | } |
||
18 | |||
19 | public static function createEmpty(): self |
||
20 | { |
||
21 | return new self([]); |
||
22 | } |
||
23 | |||
24 | public function addItem(DTO\Item $item): void |
||
27 | } |
||
28 | |||
29 | public function all(): \Traversable |
||
30 | { |
||
31 | foreach ($this->items as $item) { |
||
32 | yield $item->toArray(); |
||
33 | } |
||
34 | } |
||
35 | |||
36 | public function toArray(): array |
||
39 | } |
||
40 | } |
||
41 |