public static function createFromResponse(\SimpleXMLElement $response) { $venue = new Venue(); $venue->setId((int) $response->id); $venue->setName((string) $response->name); $location = array(); $location['city'] = (string) $response->location->city; $location['country'] = (string) $response->location->country; $location['street'] = (string) $response->location->street; $location['postalcode'] = (string) $response->location->postalcode; $venue->setLocation($location); $geoPoint = array(); $geoLocation = $response->location->children('geo', true); $geoPoint['lat'] = (string) $geoLocation->point->lat; $geoPoint['long'] = (string) $geoLocation->point->long; $venue->setGeoPoint($geoPoint); $venue->setUrl((string) $response->url); $venue->setWebsite((string) $response->website); $venue->setPhoneNumber((string) $response->phonenumber); $images = array(); foreach ($response->image as $image) { $imageAttributes = $image->attributes(); if (!empty($imageAttributes->size)) { $images[(string) $imageAttributes->size] = (string) $image; } } $venue->setImages($images); return $venue; }