/**
  * @return \Triquanta\IziTravel\DataType\CityInterface[]
  */
 public function execute()
 {
     $json = $this->requestHandler->get('/countries/' . $this->uuid . '/cities', ['languages' => $this->languageCodes, 'includes' => $this->includes, 'form' => $this->form]);
     $data = json_decode($json);
     $cities = [];
     foreach ($data as $cityData) {
         $cities[] = CityBase::createFromJson(json_encode($cityData), $this->form);
     }
     return $cities;
 }
Beispiel #2
0
 public static function createFromData(\stdClass $data)
 {
     /** @var static $city */
     $city = parent::createBaseFromData($data);
     if (isset($data->content)) {
         $content = [];
         foreach ($data->content as $contentData) {
             $content[] = CityContent::createFromData($contentData);
         }
         $city->content = $content;
     }
     return $city;
 }
Beispiel #3
0
 public static function createFromData(\stdClass $data)
 {
     /** @var static $city */
     $city = parent::createBaseFromData($data);
     $city->languageCode = $data->language;
     $city->title = $data->title;
     $city->summary = $data->summary;
     if (isset($data->images)) {
         foreach ($data->images as $imageData) {
             $city->images[] = Image::createFromData($imageData);
         }
     }
     return $city;
 }
Beispiel #4
0
 /**
  * @return \Triquanta\IziTravel\DataType\MtgObjectInterface[]|\Triquanta\IziTravel\DataType\CityInterface[]|\Triquanta\IziTravel\DataType\CountryInterface[]
  */
 public function execute()
 {
     $json = $this->requestHandler->get('/mtg/objects/search/', ['languages' => $this->languageCodes, 'includes' => $this->includes, 'form' => $this->form, 'sort_by' => $this->sort, 'type' => $this->types, 'query' => $this->query, 'limit' => $this->limit, 'offset' => $this->offset, 'region' => $this->region]);
     $data = json_decode($json);
     $objects = [];
     foreach ($data as $objectData) {
         if ($objectData->type === 'city') {
             $objects[] = CityBase::createFromJson(json_encode($objectData), $this->form);
         } elseif ($objectData->type === 'country') {
             $objects[] = CountryBase::createFromJson(json_encode($objectData), $this->form);
         } else {
             $objects[] = MtgObjectBase::createFromJson(json_encode($objectData), $this->form);
         }
     }
     return $objects;
 }
Beispiel #5
0
 /**
  * @covers ::isVisible
  */
 public function testIsVisible()
 {
     $this->assertInternalType('bool', $this->sut->isVisible());
 }
Beispiel #6
0
 /**
  * @return \Triquanta\IziTravel\DataType\CityInterface
  */
 public function execute()
 {
     $json = $this->requestHandler->get('/cities/' . $this->uuid, ['languages' => $this->languageCodes, 'includes' => $this->includes, 'form' => $this->form]);
     return CityBase::createFromJson($json, $this->form);
 }