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