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