Exemple #1
0
 protected static function createBaseFromData(\stdClass $data)
 {
     $city = new static();
     $city->uuid = $data->uuid;
     $city->revisionHash = $data->hash;
     $city->availableLanguageCodes = $data->languages;
     $city->status = $data->status;
     $city->visible = $data->visible;
     if (isset($data->children_count)) {
         $city->numberOfChildren = $data->children_count;
     }
     if (isset($data->country)) {
         $city->country = CountryBase::createFromData($data->country);
     }
     if (isset($data->location)) {
         $city->location = Location::createFromData($data->location);
     }
     if (isset($data->map)) {
         $city->map = Map::createFromData($data->map);
     }
     if (isset($data->translations)) {
         foreach ($data->translations as $translationData) {
             $city->translations[] = CountryCityTranslation::createFromData($translationData);
         }
     }
     if (isset($data->children)) {
         foreach ($data->children as $childData) {
             $city->children[] = MtgObjectBase::createFromData($childData);
         }
     }
     return $city;
 }
Exemple #2
0
 protected static function createBaseFromData(\stdClass $data)
 {
     $country = new static();
     $country->uuid = $data->uuid;
     $country->revisionHash = $data->hash;
     $country->availableLanguageCodes = $data->languages;
     $country->countryCode = $data->country_code;
     $country->status = $data->status;
     if (isset($data->map)) {
         $country->map = Map::createFromData($data->map);
     }
     if (isset($data->translations)) {
         foreach ($data->translations as $translationData) {
             $country->translations[] = CountryCityTranslation::createFromData($translationData);
         }
     }
     if (isset($data->location)) {
         $country->location = Location::createFromData($data->location);
     }
     return $country;
 }