Пример #1
0
 /**
  * @param string $name
  * @param string $country
  * @return Artist[]
  * @throws SearchNoResultsException
  */
 public function fetchByName($name, $country = self::DEFAULT_COUNTRY)
 {
     $results = $this->search(sprintf(self::ARTIST_SEARCH_QUERY, urlencode($name), $country));
     if ($results === false) {
         throw new SearchNoResultsException($name);
     }
     $albums = [];
     foreach ($results as $result) {
         $albums[] = ArtistMapper::map($result);
     }
     return new SearchResults($albums);
 }
Пример #2
0
 public function getMappers()
 {
     return [[ArtistMapper::map($this->getDataObject('artist')), 'Jacoz\\ItunesApi\\Entities\\Artist'], [AlbumMapper::map($this->getDataObject('album')), 'Jacoz\\ItunesApi\\Entities\\Album'], [TrackMapper::map($this->getDataObject('track')), 'Jacoz\\ItunesApi\\Entities\\Track']];
 }