Lines
100.00%
2 / 2
Functions and Methods
100.00%
2 / 2
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| CityIterator | 100.00% | 2 / 2 | 100.00% | 2 / 2 | 2 | 100.00% | 1 / 1 | |||
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| getIterator | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Districts\Editor\Application; | |
| 6 | ||
| 7 | use ArrayIterator; | |
| 8 | use Districts\Core\Domain\City; | |
| 9 | use Districts\Core\Domain\CityRepository; | |
| 10 | use IteratorAggregate; | |
| 11 | use Traversable; | |
| 12 | ||
| 13 | /** | |
| 14 | * @implements IteratorAggregate<City> | |
| 15 | */ | |
| 16 | final readonly class CityIterator implements IteratorAggregate | |
| 17 | { | |
| 18 | public function __construct( | |
| 19 | private CityRepository $cityRepository, | |
| 20 | ) { | |
| 21 | } | |
| 22 | ||
| 23 | /** | |
| 24 | * @return Traversable<City> | |
| 25 | */ | |
| 26 | public function getIterator(): Traversable | |
| 27 | { | |
| 28 | return new ArrayIterator($this->cityRepository->list()); | |
| 29 | } | |
| 30 | } |