src/Api/BrcBackend/DTO/CityList.php line 5

Open in your IDE?
  1. <?php
  2. namespace App\Api\BrcBackend\DTO;
  3. final class CityList extends PaginationList
  4. {
  5.     private array $cities = [];
  6.     /**
  7.      * @param array $cityList
  8.      */
  9.     public function __construct(array $cityList)
  10.     {
  11.         parent::__construct($cityList);
  12.         foreach ($cityList['items'] as $city) {
  13.             $this->cities[] = new City($city['id'], $city['name'], $city['slug']);
  14.         }
  15.     }
  16.     /**
  17.      * @return array<City>
  18.      */
  19.     public function getCities(): array
  20.     {
  21.         return $this->cities;
  22.     }
  23. }