Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
6 / 6 |
| AbstractCollection | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
6 / 6 |
| __construct | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| all | |
100.00% |
1 / 1 |
2 | |
100.00% |
4 / 4 |
|||
| <?php | |
| declare(strict_types=1); | |
| namespace App\Collection; | |
| abstract class AbstractCollection | |
| { | |
| protected iterable $items; | |
| public function __construct(iterable $items = []) | |
| { | |
| $this->items = $items; | |
| } | |
| public function all(): array | |
| { | |
| $items = $this->items; | |
| if (is_array($items)) { | |
| return $items; | |
| } | |
| return iterator_to_array($items); | |
| } | |
| } |