Beispiel #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;
 }
Beispiel #2
0
 protected static function createBaseFromData(\stdClass $data)
 {
     $object = new static();
     $object->type = $data->type;
     $object->uuid = $data->uuid;
     $object->revisionHash = $data->hash;
     $object->availableLanguageCodes = $data->languages;
     $object->status = $data->status;
     $object->contentProvider = ContentProvider::createFromData($data->content_provider);
     if (isset($data->location)) {
         $object->location = Location::createFromData($data->location);
     }
     if (isset($data->trigger_zones)) {
         foreach ($data->trigger_zones as $triggerZoneData) {
             $object->triggerZones[] = TriggerZone::createFromData($triggerZoneData);
         }
     }
     if (isset($data->purchase)) {
         $object->purchase = Purchase::createFromData($data->purchase);
     }
     if (isset($data->publisher)) {
         $object->publisher = PublisherBase::createFromData($data->publisher);
     }
     if (isset($data->city)) {
         $object->city = CityBase::createFromData($data->city);
     }
     if (isset($data->country)) {
         $object->country = CountryBase::createFromData($data->country);
     }
     return $object;
 }