예제 #1
0
 /**
  * @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;
 }
예제 #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;
 }
예제 #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;
 }
예제 #4
0
파일: Search.php 프로젝트: triquanta/libizi
 /**
  * @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;
 }
예제 #5
0
 /**
  * @covers ::isVisible
  */
 public function testIsVisible()
 {
     $this->assertInternalType('bool', $this->sut->isVisible());
 }
예제 #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);
 }