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

Open in your IDE?
  1. <?php
  2. namespace App\Api\BrcBackend\DTO;
  3. final class CityProfilesList extends PaginationList
  4. {
  5.     private array $profiles = [];
  6.     private City $city;
  7.     /**
  8.      * @param array $response
  9.      *
  10.      * @throws \Exception
  11.      */
  12.     public function __construct(array $response)
  13.     {
  14.         parent::__construct($response);
  15.         $this->city = new City($response['city']['id'], $response['city']['name'], $response['city']['slug']);
  16.         foreach ($response['items'] as $profile) {
  17.             $this->profiles[] = new Profile($profile);
  18.         }
  19.     }
  20.     /**
  21.      * @return array<Profile>
  22.      */
  23.     public function getProfiles(): array
  24.     {
  25.         return $this->profiles;
  26.     }
  27.     /**
  28.      * @return City
  29.      */
  30.     public function getCity(): City
  31.     {
  32.         return $this->city;
  33.     }
  34. }