| Total Complexity | 9 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Coverage | 76.47% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | abstract class Collection implements \IteratorAggregate, \Countable |
||
| 8 | { |
||
| 9 | protected array $items; |
||
| 10 | |||
| 11 | 4 | final public function __construct(iterable $items) |
|
| 12 | { |
||
| 13 | 4 | $this->items = $items instanceof \Traversable ? iterator_to_array($items) : $items; |
|
| 14 | 4 | $this->assertType(); |
|
| 15 | 3 | } |
|
| 16 | |||
| 17 | public function getItems(): array |
||
| 18 | { |
||
| 19 | return $this->items; |
||
| 20 | } |
||
| 21 | |||
| 22 | 1 | public function count(): int |
|
| 23 | { |
||
| 24 | 1 | return count($this->items); |
|
| 25 | } |
||
| 26 | |||
| 27 | public function filter(callable $filter): static |
||
| 30 | } |
||
| 31 | |||
| 32 | 2 | public function getIterator(): \ArrayIterator |
|
| 35 | } |
||
| 36 | |||
| 37 | abstract protected function getType(): string; |
||
| 38 | |||
| 39 | 4 | private function assertType(): void |
|
| 50 |