Exemplo n.º 1
0
 /**
  * @link http://www.last.fm/api/show/radio.search
  *
  * @param string $artist
  * @throws \Lertify\Lastfm\Exception\NotFoundException
  * @return \Lertify\Lastfm\Api\Data\ArrayCollection
  */
 public function search($artist)
 {
     $params = array('name' => $artist);
     $result = $this->get(self::PREFIX . 'search', $params);
     $resultStations = $result['stations'];
     if (!isset($resultStations['station'])) {
         throw new NotFoundException('No station found for this artist or tag!');
     }
     if (isset($resultStations['station'][0])) {
         $stations = $resultStations['station'];
     } else {
         $stations = array($resultStations['station']);
     }
     $StationsList = new ArrayCollection();
     foreach ($stations as $stationRow) {
         $Station = new Data\Radio\Station();
         $Station->setName(Util::toSting($stationRow['name']));
         $Station->setUrl(Util::toSting($stationRow['url']));
         $StationsList->add($Station);
     }
     return $StationsList;
 }
Exemplo n.º 2
0
 /**
  * @link http://www.last.fm/api/show/playlist.create
  *
  * @param string $sk
  * @param string|null $title
  * @param string|null $description
  * @throws Exception
  * @return \Lertify\Lastfm\Api\Data\Playlist\Playlist
  */
 public function create($sk, $title = null, $description = null)
 {
     $params = array('sk' => $sk);
     if (null !== $title) {
         $params['title'] = $title;
     }
     if (null !== $description) {
         $params['description'] = $description;
     }
     $result = $this->post(self::PREFIX . 'create', $params, array('is_signed' => true));
     $resultPlaylists = $result['playlists'];
     $Playlist = new Data\Playlist\Playlist();
     if (!isset($resultPlaylists['playlist'])) {
         throw new Exception('No playlist created!');
     }
     $playlistRow = $resultPlaylists['playlist'];
     $User = new Data\Playlist\User();
     $User->setName($resultPlaylists['@attr']['user']);
     $Playlist->setId((int) $playlistRow['id']);
     $Playlist->setTitle(Util::toSting($playlistRow['title']));
     $Playlist->setDescription(Util::toSting($playlistRow['description']));
     $Playlist->setDate(Util::toSting($playlistRow['date']));
     $Playlist->setSize((int) $playlistRow['size']);
     $Playlist->setDuration((int) $playlistRow['duration']);
     $Playlist->setStreamable((bool) (int) $playlistRow['streamable']);
     $Playlist->setCreator(Util::toSting($playlistRow['creator']));
     $Playlist->setUrl(Util::toSting($playlistRow['url']));
     $PlaylistImages = new ArrayCollection();
     if (isset($playlistRow['image'])) {
         foreach ($playlistRow['image'] as $image) {
             $PlaylistImages->set(Util::toSting($image['size']), Util::toSting($image['#text']));
         }
     }
     $Playlist->setImages($PlaylistImages);
     $Playlist->setUser($User);
     return $Playlist;
 }
Exemplo n.º 3
0
 /**
  * @link http://www.last.fm/api/show/tasteometer.compare
  *
  * @param string $typeOne
  * @param string $typeTwo
  * @param string|array $valueOne
  * @param string|array $valueTwo
  * @param int $limit
  * @throws InvalidArgumentException
  * @return \Lertify\Lastfm\Api\Data\Tasteometer\Comparison
  */
 public function compare($typeOne, $typeTwo, $valueOne, $valueTwo, $limit = 5)
 {
     if (is_array($valueOne)) {
         if (count($valueOne) > 100) {
             throw new InvalidArgumentException('Number of artists is higher then allowed!');
         } else {
             $valueOne = implode(',', $valueOne);
         }
     }
     if (is_array($valueTwo)) {
         if (count($valueTwo) > 100) {
             throw new InvalidArgumentException('Number of artists is higher then allowed!');
         } else {
             $valueTwo = implode(',', $valueTwo);
         }
     }
     $params = array('type1' => $typeOne, 'type2' => $typeTwo, 'value1' => $valueOne, 'value2' => $valueTwo, 'limit' => $limit);
     $result = $this->get(self::PREFIX . 'compare', $params);
     $resultComparison = $result['comparison'];
     $Comparison = new Data\Tasteometer\Comparison();
     $UsersList = new ArrayCollection();
     if (isset($resultComparison['input']['user'][0])) {
         $users = $resultComparison['input']['user'];
     } else {
         $users = array($resultComparison['input']['user']);
     }
     foreach ($users as $userRow) {
         $User = new Data\Tasteometer\User();
         $User->setName(Util::toSting($userRow['name']));
         $User->setUrl(Util::toSting($userRow['url']));
         $Images = new ArrayCollection();
         if (isset($userRow['image'])) {
             foreach ($userRow['image'] as $image) {
                 $Images->set(Util::toSting($image['size']), Util::toSting($image['#text']));
             }
         }
         $User->setImages($Images);
         $UsersList->add($User);
     }
     $Comparison->setInput($UsersList);
     $Comparison->setScore((double) $resultComparison['result']['score']);
     $Artists = $resultComparison['result']['artists'];
     $Comparison->setMatches((int) $Artists['@attr']['matches']);
     $ArtistList = new ArrayCollection();
     if (isset($Artists['artist'][0])) {
         $artistsList = $Artists['artist'];
     } else {
         $artistsList = array($Artists['artist']);
     }
     foreach ($artistsList as $artistRow) {
         $Artist = new Data\Tasteometer\Artist();
         $Artist->setName(Util::toSting($artistRow['name']));
         $Artist->setUrl(Util::toSting($artistRow['url']));
         $Images = new ArrayCollection();
         if (isset($artistRow['image'])) {
             foreach ($artistRow['image'] as $image) {
                 $Images->set(Util::toSting($image['size']), Util::toSting($image['#text']));
             }
         }
         $Artist->setImages($Images);
         $ArtistList->add($Artist);
     }
     $Comparison->setArtists($ArtistList);
     return $Comparison;
 }
Exemplo n.º 4
0
 /**
  * @link http://www.last.fm/api/show/tag.search
  *
  * @param string $tag
  * @throws \Lertify\Lastfm\Exception\NotFoundException
  * @return \Lertify\Lastfm\Api\Data\PagedCollection
  */
 public function search($tag)
 {
     $params = array('tag' => $tag);
     $self = $this;
     $resultCallback = function ($page, $limit) use($params, $self) {
         $params = array_merge($params, array('page' => $page, 'limit' => $limit));
         $result = $self->get(Tag::PREFIX . 'search', $params);
         $resultTagmatches = $result['results']['tagmatches'];
         if (!isset($resultTagmatches['tag'])) {
             throw new NotFoundException('There is no such tag!');
         }
         if (isset($resultTagmatches['tag'][0])) {
             $tags = $resultTagmatches['tag'];
         } else {
             $tags = array($resultTagmatches['tag']);
         }
         $totalResults = (int) $result['results']['opensearch:totalResults'];
         $itemsPerPage = (int) $result['results']['opensearch:itemsPerPage'];
         $List = new ArrayCollection();
         foreach ($tags as $tagsRow) {
             $Tag = new Data\Tag\Tag();
             $Tag->setName(Util::toSting($tagsRow['name']));
             $Tag->setCount((int) $tagsRow['count']);
             $Tag->setUrl(Util::toSting($tagsRow['url']));
             $List->add($Tag);
         }
         return array('results' => $List, 'total_pages' => ceil($totalResults / $itemsPerPage), 'total_results' => $totalResults);
     };
     return new PagedCollection($resultCallback);
 }
Exemplo n.º 5
0
 /**
  * @link http://www.last.fm/api/show/geo.getTopTracks
  *
  * @param string $country
  * @param string|null $location
  * @throws \Lertify\Lastfm\Exception\NotFoundException
  * @return \Lertify\Lastfm\Api\Data\PagedCollection
  */
 public function getTopTracks($country, $location = null)
 {
     $params = array('country' => $country, 'location' => $location);
     $self = $this;
     $resultCallback = function ($page, $limit) use($params, $self) {
         $params = array_merge($params, array('page' => $page, 'limit' => $limit));
         $result = $self->get(Geo::PREFIX . 'getTopTracks', $params);
         $resultToptracks = $result['toptracks'];
         if (!isset($resultToptracks['track'])) {
             throw new NotFoundException('No top tracks found for this location!');
         }
         $totalResults = (int) $resultToptracks['@attr']['total'];
         $totalPages = (int) $resultToptracks['@attr']['totalPages'];
         if (isset($resultToptracks['track'][0])) {
             $tracks = $resultToptracks['track'];
         } else {
             $tracks = array($resultToptracks['track']);
         }
         $List = new ArrayCollection();
         foreach ($tracks as $trackRow) {
             $Track = new Data\Track();
             $Track->setName(Util::toSting($trackRow['name']));
             $Track->setDuration((int) $trackRow['duration']);
             $Track->setListeners((int) $trackRow['listeners']);
             $Track->setMbId(Util::toSting($trackRow['mbid']));
             $Track->setUrl(Util::toSting($trackRow['url']));
             $Track->setRank((int) $trackRow['@attr']['rank']);
             $Track->setStreamable((bool) (int) $trackRow['streamable']['#text']);
             $Track->setStreamableFulltrack((bool) (int) $trackRow['streamable']['fulltrack']);
             $Track->setArtistName(Util::toSting($trackRow['artist']['name']));
             $Track->setArtistMbId(Util::toSting($trackRow['artist']['mbid']));
             $Track->setArtistUrl(Util::toSting($trackRow['artist']['url']));
             $TrackImages = new ArrayCollection();
             if (isset($trackRow['image'])) {
                 foreach ($trackRow['image'] as $image) {
                     $TrackImages->set(Util::toSting($image['size']), Util::toSting($image['#text']));
                 }
             }
             $Track->setImages($TrackImages);
             $List->add($Track);
         }
         return array('results' => $List, 'total_pages' => $totalPages, 'total_results' => $totalResults);
     };
     return new PagedCollection($resultCallback);
 }
Exemplo n.º 6
0
 /**
  * @param array $eventRow
  * @return \Lertify\Lastfm\Api\Data\Venue\Event
  */
 public function fillEvent(array $eventRow)
 {
     $Event = new Data\Venue\Event();
     $Event->setId((int) $eventRow['id']);
     $Event->setTitle(Util::toSting($eventRow['title']));
     if (isset($resultEvent['artists']['headliner'])) {
         $Event->setHeadliner(Util::toSting($eventRow['artists']['headliner']));
     }
     $Artists = new ArrayCollection();
     $resultArtists = $eventRow['artists'];
     if (is_array($resultArtists['artist'])) {
         $artistList = $resultArtists['artist'];
     } else {
         $artistList = array($resultArtists['artist']);
     }
     foreach ($artistList as $artistName) {
         $Artist = new Data\Venue\Artist();
         $Artist->setName(Util::toSting($artistName));
         $Artists->add($Artist);
     }
     $Event->setArtists($Artists);
     $Venue = new Data\Venue\Venue();
     $venueRow = $eventRow['venue'];
     $Venue->setId((int) $venueRow['id']);
     $Venue->setName(Util::toSting($venueRow['name']));
     $Venue->setCity(Util::toSting($venueRow['location']['city']));
     $Venue->setCountry(Util::toSting($venueRow['location']['country']));
     $Venue->setStreet(Util::toSting($venueRow['location']['street']));
     $Venue->setPostalcode((int) $venueRow['location']['postalcode']);
     $Venue->setLatitude((double) $venueRow['location']['geo:point']['geo:lat']);
     $Venue->setLongitude((double) $venueRow['location']['geo:point']['geo:long']);
     $Venue->setUrl(Util::toSting($venueRow['url']));
     $Venue->setWebsite(Util::toSting($venueRow['website']));
     $Venue->setPhonenumber(Util::toSting($venueRow['phonenumber']));
     $VenueImages = new ArrayCollection();
     foreach ($venueRow['image'] as $venueRowImage) {
         $VenueImages->set(Util::toSting($venueRowImage['size']), Util::toSting($venueRowImage['#text']));
     }
     $Venue->setImages($VenueImages);
     $Event->setVenue($Venue);
     $Event->setStartDate(Util::toSting($eventRow['startDate']));
     $Event->setDescription(Util::toSting($eventRow['description']));
     $EventImages = new ArrayCollection();
     foreach ($eventRow['image'] as $image) {
         $EventImages->set(Util::toSting($image['size']), Util::toSting($image['#text']));
     }
     $Event->setImages($EventImages);
     $Event->setAttendance((int) $eventRow['attendance']);
     $Event->setReviews((int) $eventRow['reviews']);
     if (isset($eventRow['tag'])) {
         $Event->setTag(Util::toSting($eventRow['tag']));
     }
     $TagsList = new ArrayCollection();
     if (isset($eventRow['tags'])) {
         $resultTags = $eventRow['tags'];
         if (is_array($resultTags['tag'])) {
             $tagList = $resultTags['tag'];
         } else {
             $tagList = array($resultTags['tag']);
         }
         foreach ($tagList as $tagRow) {
             $TagsList->add(Util::toSting($tagRow));
         }
     }
     $Event->setTags($TagsList);
     $Event->setUrl(Util::toSting($eventRow['url']));
     $Event->setWebsite(Util::toSting($eventRow['website']));
     $Event->setCancelled((int) $eventRow['cancelled']);
     $Tickets = new ArrayCollection();
     if (isset($eventRow['tickets']) && is_array($eventRow['tickets'])) {
         foreach ($eventRow['tickets']['ticket'] as $ticketRow) {
             $Tickets->add(array('supplier' => Util::toSting($ticketRow['supplier']), 'url' => Util::toSting($ticketRow['#text'])));
         }
     }
     $Event->setTickets($Tickets);
     return $Event;
 }
Exemplo n.º 7
0
 /**
  * @link http://www.last.fm/api/show/group.getWeeklyTrackChart
  *
  * @param string $group
  * @param int|null $from
  * @param int|null $to
  * @throws \Lertify\Lastfm\Exception\NotFoundException
  * @return \Lertify\Lastfm\Api\Data\ArrayCollection
  */
 public function getWeeklyTrackChart($group, $from = null, $to = null)
 {
     $params = array('group' => $group, 'from' => $from, 'to' => $to);
     $result = $this->get(self::PREFIX . 'getWeeklyTrackChart', $params);
     $resultWeeklytrackchart = $result['weeklytrackchart'];
     if (!isset($resultWeeklytrackchart['track'])) {
         throw new NotFoundException('No tracks found!');
     }
     if (isset($resultWeeklytrackchart['track'][0])) {
         $tracks = $resultWeeklytrackchart['track'];
     } else {
         $tracks = array($resultWeeklytrackchart['track']);
     }
     $TracksList = new ArrayCollection();
     foreach ($tracks as $trackRow) {
         $Track = new Data\Group\Track();
         $Track->setArtistName(Util::toSting($trackRow['artist']['#text']));
         $Track->setArtistMbId(Util::toSting($trackRow['artist']['mbid']));
         $Track->setName(Util::toSting($trackRow['name']));
         $Track->setMbId(Util::toSting($trackRow['mbid']));
         $Track->setPlaycount((int) $trackRow['playcount']);
         $Track->setUrl(Util::toSting($trackRow['url']));
         $Track->setRank((int) $trackRow['@attr']['rank']);
         $TrackImages = new ArrayCollection();
         if (isset($trackRow['image'])) {
             foreach ($trackRow['image'] as $image) {
                 $TrackImages->set(Util::toSting($image['size']), Util::toSting($image['#text']));
             }
         }
         $Track->setImages($TrackImages);
         $TracksList->add($Track);
     }
     return $TracksList;
 }
Exemplo n.º 8
0
 /**
  * @link http://www.last.fm/api/show/library.getTracks
  *
  * @param string $user
  * @param string|null $artist
  * @param string|null $album
  * @throws \Lertify\Lastfm\Exception\NotFoundException
  * @return \Lertify\Lastfm\Api\Data\PagedCollection
  */
 public function getTracks($user, $artist = null, $album = null)
 {
     $params = array('user' => $user, 'artist' => $artist, 'album' => $album);
     $self = $this;
     $resultCallback = function ($page, $limit) use($params, $self) {
         $params = array_merge($params, array('page' => $page, 'limit' => $limit));
         $result = $self->get(Library::PREFIX . 'getTracks', $params);
         $resultTracks = $result['tracks'];
         if (!isset($resultTracks['track'])) {
             throw new NotFoundException('This user hasn\'t any tracks in his library!');
         }
         $totalResults = (int) $resultTracks['@attr']['total'];
         $totalPages = (int) $resultTracks['@attr']['totalPages'];
         if (isset($resultTracks['track'][0])) {
             $tracks = $resultTracks['track'];
         } else {
             $tracks = array($resultTracks['track']);
         }
         $List = new ArrayCollection();
         foreach ($tracks as $tracksRow) {
             $Track = new Data\Library\Track();
             $Track->setName(Util::toSting($tracksRow['name']));
             $Track->setDuration((int) $tracksRow['name']);
             $Track->setPlaycount((int) $tracksRow['playcount']);
             $Track->setTagcount((int) $tracksRow['tagcount']);
             $Track->setMbId(Util::toSting($tracksRow['mbid']));
             $Track->setUrl(Util::toSting($tracksRow['url']));
             $Track->setStreamable((bool) $tracksRow['streamable']['#text']);
             $Track->setStreamableFulltrack((bool) $tracksRow['streamable']['fulltrack']);
             $Track->setArtistName(Util::toSting($tracksRow['artist']['name']));
             $Track->setArtistMbId(Util::toSting($tracksRow['artist']['mbid']));
             $Track->setArtistUrl(Util::toSting($tracksRow['artist']['url']));
             if (isset($tracksRow['album'])) {
                 $Track->setAlbumName(Util::toSting($tracksRow['album']['name']));
                 $Track->setAlbumPosition((int) $tracksRow['album']['position']);
             }
             $TrackImages = new ArrayCollection();
             if (isset($tracksRow['image'])) {
                 foreach ($tracksRow['image'] as $image) {
                     $TrackImages->set(Util::toSting($image['size']), Util::toSting($image['#text']));
                 }
             }
             $Track->setImages($TrackImages);
             $List->add($Track);
         }
         return array('results' => $List, 'total_pages' => $totalPages, 'total_results' => $totalResults);
     };
     return new PagedCollection($resultCallback);
 }
Exemplo n.º 9
0
 /**
  * @link http://www.last.fm/api/show/event.getShouts
  *
  * @param int $eventId
  * @throws \Lertify\Lastfm\Exception\NotFoundException
  * @return \Lertify\Lastfm\Api\Data\PagedCollection
  */
 public function getShouts($eventId)
 {
     $params = array('event' => $eventId);
     $self = $this;
     $resultCallback = function ($page, $limit) use($params, $self) {
         $params = array_merge($params, array('page' => $page, 'limit' => $limit));
         /** @var $self Event */
         $result = $self->get(Event::PREFIX . 'getShouts', $params);
         $resultShouts = $result['shouts'];
         if (!isset($resultShouts['shout'])) {
             throw new NotFoundException('No shouts found for this event!');
         }
         $totalResults = (int) $resultShouts['@attr']['total'];
         $totalPages = (int) $resultShouts['@attr']['totalPages'];
         if (isset($resultShouts['shout'][0])) {
             $shouts = $resultShouts['shout'];
         } else {
             $shouts = array($resultShouts['shout']);
         }
         $List = new ArrayCollection();
         foreach ($shouts as $shoutRow) {
             $Shout = new Data\Shout();
             $Shout->setAuthor(Util::toSting($shoutRow['author']));
             $Shout->setBody(Util::toSting($shoutRow['body']));
             $Shout->setDate(Util::toSting($shoutRow['date']));
             $List->add($Shout);
         }
         return array('results' => $List, 'total_pages' => $totalPages, 'total_results' => $totalResults);
     };
     return new PagedCollection($resultCallback);
 }
Exemplo n.º 10
0
 /**
  * @param array $params
  * @throws \Lertify\Lastfm\Exception\NotFoundException
  * @return \Lertify\Lastfm\Api\Data\ArrayCollection
  */
 private function fetchGetTopTags(array $params)
 {
     $result = $this->get(self::PREFIX . 'getTopTags', $params);
     $resultTopTags = $result['toptags'];
     if (!isset($resultTopTags['tag'])) {
         throw new NotFoundException('There are no top tags for this atrist and track!');
     }
     if (isset($resultTopTags['tag'][0]) && is_array($resultTopTags['tag'][0])) {
         $topTags = $resultTopTags['tag'];
     } else {
         $topTags = array($resultTopTags['tag']);
     }
     $List = new ArrayCollection();
     foreach ($topTags as $topTagRecord) {
         $Toptag = new Data\Track\Tag();
         $Toptag->setName(Util::toSting($topTagRecord['name']));
         $Toptag->setCount((int) $topTagRecord['count']);
         $Toptag->setUrl(Util::toSting($topTagRecord['url']));
         $List->add($Toptag);
     }
     return $List;
 }
Exemplo n.º 11
0
 /**
  * @param array $images
  * @return \Lertify\Lastfm\Api\Data\ArrayCollection
  */
 public function getImageList(array $images)
 {
     $ImagesList = new ArrayCollection();
     foreach ($images as $image) {
         $ImagesList->set((string) $image['size'], (string) $image['#text']);
     }
     return $ImagesList;
 }
Exemplo n.º 12
0
 /**
  * @param array $params
  * @throws \Lertify\Lastfm\Exception\NotFoundException
  * @return \Lertify\Lastfm\Api\Data\PagedCollection
  */
 private function fetchEvents(array $params)
 {
     $self = $this;
     $resultCallback = function ($page, $limit) use($params, $self) {
         $params = array_merge($params, array('page' => $page, 'limit' => $limit));
         /** @var $self Artist */
         $result = $self->get(Artist::PREFIX . 'getEvents', $params);
         $resultEvents = $result['events'];
         if (!isset($resultEvents['event'])) {
             throw new NotFoundException('No events found for this artist!');
         }
         $List = new ArrayCollection();
         $totalResults = (int) $resultEvents['@attr']['total'];
         $totalPages = (int) $resultEvents['@attr']['totalPages'];
         foreach ($resultEvents['event'] as $eventRow) {
             $Event = new Event();
             $Event->setId((int) $eventRow['id']);
             $Event->setTitle(Util::toSting($eventRow['title']));
             if (isset($eventRow['artists']['headliner'])) {
                 $Event->setHeadliner(Util::toSting($eventRow['artists']['headliner']));
             }
             $Artists = new ArrayCollection();
             if (is_array($eventRow['artists']['artist'])) {
                 $artistList = $eventRow['artists']['artist'];
             } else {
                 $artistList = array($eventRow['artists']['artist']);
             }
             foreach ($artistList as $artistName) {
                 $Artist = new Data\Artist\Artist();
                 $Artist->setName(Util::toSting($artistName));
                 $Artists->add($Artist);
             }
             $Event->setArtists($Artists);
             $Venue = new Venue();
             $venueRow = $eventRow['venue'];
             $Venue->setId((int) $venueRow['id']);
             $Venue->setName(Util::toSting($venueRow['name']));
             $Venue->setCity(Util::toSting($venueRow['location']['city']));
             $Venue->setCountry(Util::toSting($venueRow['location']['country']));
             $Venue->setStreet(Util::toSting($venueRow['location']['street']));
             $Venue->setPostalcode((int) $venueRow['location']['postalcode']);
             $Venue->setLatitude((double) $venueRow['location']['geo:point']['geo:lat']);
             $Venue->setLongitude((double) $venueRow['location']['geo:point']['geo:long']);
             $Venue->setUrl(Util::toSting($venueRow['url']));
             $Venue->setWebsite(Util::toSting($venueRow['website']));
             $Venue->setPhonenumber(Util::toSting($venueRow['phonenumber']));
             $VenueImages = new ArrayCollection();
             foreach ($venueRow['image'] as $venueRowImage) {
                 $VenueImages->set(Util::toSting($venueRowImage['size']), Util::toSting($venueRowImage['#text']));
             }
             $Venue->setImages($VenueImages);
             $Event->setVenue($Venue);
             $Event->setStartDate(Util::toSting($eventRow['startDate']));
             $Event->setDescription(Util::toSting($eventRow['description']));
             $EventImages = new ArrayCollection();
             foreach ($eventRow['image'] as $eventImage) {
                 $EventImages->set(Util::toSting($eventImage['size']), Util::toSting($eventImage['#text']));
             }
             $Event->setImages($EventImages);
             $Event->setAttendance((int) $eventRow['attendance']);
             $Event->setReviews((int) $eventRow['reviews']);
             $TagsList = new ArrayCollection();
             if (isset($eventRow['tags'])) {
                 if (is_array($eventRow['tags']['tag'])) {
                     $tagList = $eventRow['tags']['tag'];
                 } else {
                     $tagList = array($eventRow['tags']['tag']);
                 }
                 foreach ($tagList as $tagRow) {
                     $TagsList->add(Util::toSting($tagRow));
                 }
             }
             if (isset($eventRow['tag'])) {
                 $Event->setTag(Util::toSting($eventRow['tag']));
             }
             $Event->setTags($TagsList);
             $Event->setUrl(Util::toSting($eventRow['url']));
             $Event->setWebsite(Util::toSting($eventRow['website']));
             $Event->setCancelled((int) $eventRow['cancelled']);
             $Tickets = new ArrayCollection();
             if (is_array($eventRow['tickets'])) {
                 foreach ($eventRow['tickets']['ticket'] as $ticketRow) {
                     $Tickets->add(array('supplier' => Util::toSting($ticketRow['supplier']), 'url' => Util::toSting($ticketRow['#text'])));
                 }
             }
             $Event->setTickets($Tickets);
             $List->add($Event);
         }
         return array('results' => $List, 'total_pages' => $totalPages, 'total_results' => $totalResults);
     };
     return new PagedCollection($resultCallback);
 }