/** Create a Event object from a SimpleXMLElement. * * @param SimpleXMLElement $xml A SimpleXMLElement. * @return Event A Event object. * * @static * @access public * @internal */ public static function fromSimpleXMLElement(SimpleXMLElement $xml) { $artists = array(); $images = array(); if ($xml->artists) { foreach ($xml->artists->artist as $artist) { $artists[] = Util::toString($artist); } $artists['headliner'] = Util::toString($xml->artists->headliner); } if ($xml->image) { foreach ($xml->image as $image) { $images[Util::toImageType($image['size'])] = Util::toString($image); } } return new Event(Util::toInteger($xml->id), Util::toString($xml->title), $artists, $xml->venue ? Venue::fromSimpleXMLElement($xml->venue) : null, Util::toTimestamp($xml->startDate), Util::toString($xml->description), $images, Util::toString($xml->url), Util::toInteger($xml->attendance), Util::toInteger($xml->reviews), Util::toString($xml->tag)); }
/** Search for a venue by venue name . * * @param string $venue The venue name you would like to search for. (Required) * @param integer $limit The number of results to fetch per page. Defaults to 50. (Optional) * @param integer $page The results page you would like to fetch. (Optional) * @param string $country Filter your results by country. Expressed as an ISO 3166-2 code. (Optional) * @return PaginatedResult A PaginatedResult object. * @see PaginatedResult * * @static * @access public * @throws Error */ public static function search($venue, $limit = null, $page = null, $country = null) { $xml = CallerFactory::getDefaultCaller()->call('venue.search', array('venue' => $venue, 'limit' => $limit, 'page' => $page, 'country' => $country)); $venues = array(); foreach ($xml->venuematches->children() as $venue) { $venues[] = Venue::fromSimpleXMLElement($venue); } $opensearch = $xml->children('http://a9.com/-/spec/opensearch/1.1/'); return new PaginatedResult(Util::toInteger($opensearch->totalResults), Util::toInteger($opensearch->startIndex), Util::toInteger($opensearch->itemsPerPage), $venues); }