| Total Complexity | 7 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | abstract class AbstractCollection implements Countable, IteratorAggregate |
||
| 14 | { |
||
| 15 | abstract protected function createItemFromStdClass(stdClass $content): object; |
||
| 16 | |||
| 17 | /** @var ArrayObject */ |
||
| 18 | protected $collection; |
||
| 19 | |||
| 20 | 36 | public function __construct(array $collection) |
|
| 21 | { |
||
| 22 | 36 | $this->collection = new ArrayObject(); |
|
| 23 | 36 | foreach ($collection as $content) { |
|
| 24 | 31 | $this->collection->append($this->createItemFromStdClass($content)); |
|
| 25 | } |
||
| 26 | 36 | } |
|
| 27 | |||
| 28 | 11 | public function get(int $index): object |
|
| 34 | } |
||
| 35 | |||
| 36 | 18 | public function count(): int |
|
| 37 | { |
||
| 38 | 18 | return $this->collection->count(); |
|
| 39 | } |
||
| 40 | |||
| 41 | 5 | public function first(): object |
|
| 44 | } |
||
| 45 | |||
| 46 | 8 | public function getIterator(): ArrayIterator |
|
| 49 | } |
||
| 50 | } |
||
| 51 |