| Total Complexity | 5 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | final class GetCitiesResponse |
||
| 12 | { |
||
| 13 | #[Serializer\Type("ArrayCollection<VasilDakov\Econt\Model\City>")] |
||
| 14 | private ArrayCollection $cities; |
||
| 15 | |||
| 16 | public function __construct() |
||
| 17 | { |
||
| 18 | $this->cities = new ArrayCollection(); |
||
| 19 | } |
||
| 20 | |||
| 21 | public function findById(int $id): ?Model\City |
||
| 22 | { |
||
| 23 | $collection = $this->cities->filter(function (Model\City $city) use ($id) { |
||
| 24 | return $city->id === $id; |
||
| 25 | }); |
||
| 26 | |||
| 27 | return (!$collection->isEmpty()) ? $collection->first() : null; |
||
| 28 | } |
||
| 29 | |||
| 30 | public function findByName(string $name): ?Model\City |
||
| 37 | } |
||
| 38 | } |
||
| 39 |