Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function getIterator()
 {
     if ($this->sortedIterator === null) {
         $this->sortedIterator = new \ArrayIterator($this->enumerable()->toArray(true));
         $this->sortedIterator->uasort($this->comparator());
     }
     return $this->sortedIterator;
 }
Exemplo n.º 2
0
 /**
  * Performs calls to the lookup method in the Spotify Web APIs
  * @param string $uri
  * @param array $options
  * @link  https://developer.spotify.com/technologies/web-api/lookup/
  */
 public function lookup($uri, $options)
 {
     $uri_object = new SpotifyURI($uri);
     if ($uri_object->is_valid) {
         $q = '?uri=' . $uri;
     }
     if (Constants::DETAILED_INFO) {
         switch ($uri_object->type) {
             case 'artist':
                 $q .= '&extras=albumdetail';
                 break;
             case 'album':
                 $q .= '&extras=trackdetail';
                 break;
                 //nothing extra to fetch
             //nothing extra to fetch
             case 'track':
             default:
                 break;
         }
     }
     $this->query_string = $q;
     $data = $this->_call_spotify_api();
     $it = new Iterator($data);
     isset($options['filter']) ? new Filter($it) : '';
     isset($options['sort']) ? $it->uasort(array($options['sort'])) : '';
     return new Response(1, $data);
     // parse the lookup response.
 }