Total Complexity | 5 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
26 | trait CollectionTrait |
||
27 | { |
||
28 | private array $collection; |
||
29 | |||
30 | 34 | public function getIterator(): Iterator |
|
31 | { |
||
32 | 34 | foreach ($this->collection as $item) { |
|
33 | 25 | yield $item; |
|
34 | } |
||
35 | } |
||
36 | |||
37 | 39 | public function count(): int |
|
38 | { |
||
39 | 39 | return count($this->collection); |
|
40 | } |
||
41 | |||
42 | 11 | public function isEmpty(): bool |
|
43 | { |
||
44 | 11 | return empty($this->collection); |
|
45 | } |
||
46 | |||
47 | 3 | public function toArray(): array |
|
50 | } |
||
51 | } |
||
52 |