Beispiel #1
0
 public static function createFromData(\stdClass $data)
 {
     $content = new static();
     $content->languageCode = $data->language;
     $content->title = $data->title;
     $content->summary = $data->summary;
     $content->description = $data->desc;
     if (isset($data->news)) {
         $content->news = $data->news;
     }
     if (isset($data->images)) {
         foreach ($data->images as $imageData) {
             $content->images[] = Image::createFromData($imageData);
         }
     }
     if (isset($data->audio)) {
         foreach ($data->audio as $audioData) {
             $content->audio[] = Audio::createFromData($audioData);
         }
     }
     if (isset($data->video)) {
         foreach ($data->video as $videoData) {
             $content->videos[] = Video::createFromData($videoData);
         }
     }
     if (isset($data->children)) {
         foreach ($data->children as $childData) {
             $content->children[] = MtgObjectBase::createFromData($childData);
         }
     }
     if (isset($data->collections)) {
         foreach ($data->collections as $collectionData) {
             $content->collections[] = MtgObjectBase::createFromData($collectionData);
         }
     }
     if (isset($data->references)) {
         foreach ($data->references as $referenceData) {
             $content->references[] = MtgObjectBase::createFromData($referenceData);
         }
     }
     if (isset($data->playback)) {
         $content->playback = Playback::createFromData($data->playback);
     }
     if (isset($data->quiz)) {
         $content->quiz = Quiz::createFromData($data->quiz);
     }
     return $content;
 }
Beispiel #2
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;
 }