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
3declare(strict_types=1);
4
5namespace Districts\Editor\Application;
6
7use ArrayIterator;
8use Districts\Core\Domain\City;
9use Districts\Core\Domain\CityRepository;
10use IteratorAggregate;
11use Traversable;
12
13/**
14 * @implements IteratorAggregate<City>
15 */
16final 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}