Пример #1
0
 public static function createFromData(\stdClass $data)
 {
     /** @var static $country */
     $country = parent::createBaseFromData($data);
     $country->languageCode = $data->language;
     $country->title = $data->title;
     $country->summary = $data->summary;
     return $country;
 }
Пример #2
0
 /**
  * @return \Triquanta\IziTravel\DataType\CountryInterface[]
  */
 public function execute()
 {
     $json = $this->requestHandler->get('/countries', ['languages' => $this->languageCodes, 'includes' => $this->includes, 'form' => $this->form, 'limit' => $this->limit, 'offset' => $this->offset]);
     $data = json_decode($json);
     $countries = [];
     foreach ($data as $countryData) {
         $countries[] = CountryBase::createFromJson(json_encode($countryData), $this->form);
     }
     return $countries;
 }
Пример #3
0
 public static function createFromData(\stdClass $data)
 {
     /** @var static $country */
     $country = parent::createBaseFromData($data);
     if (isset($data->content)) {
         foreach ($data->content as $contentData) {
             $country->content[] = CountryContent::createFromData($contentData);
         }
     }
     return $country;
 }
Пример #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;
 }
Пример #5
0
 /**
  * @return \Triquanta\IziTravel\DataType\CountryInterface
  */
 public function execute()
 {
     $json = $this->requestHandler->get('/countries/' . $this->uuid, ['languages' => $this->languageCodes, 'includes' => $this->includes, 'form' => $this->form]);
     return CountryBase::createFromJson($json, $this->form);
 }
Пример #6
0
 /**
  * @covers ::isPublished
  */
 public function testIsPublished()
 {
     $this->assertTrue($this->sut->isPublished());
 }