src/lastfmapi/Api/ArtistApi.php
public function getTopFans($methodVars)
    {
        // Check for required variables
        if (!empty($methodVars['artist']) || !empty($methodVars['mbid'])) {
            $vars = array(
                'method' => 'artist.gettopfans',
                'api_key' => $this->auth->apiKey
            );
            $vars = array_merge($vars, $methodVars);

            if ($call = $this->apiGetCall($vars)) {
                if (count($call->topfans->user) > 0) {
                    $i = 0;
                    foreach ($call->topfans->user as $user) {
                        $topFans[$i]['name'] = (string) $user->name;
                        $topFans[$i]['url'] = (string) $user->url;
                        $topFans[$i]['image']['small'] = (string) $user->image[0];
                        $topFans[$i]['image']['medium'] = (string) $user->image[1];
                        $topFans[$i]['image']['large'] = (string) $user->image[2];
                        $topFans[$i]['weight'] = (string) $user->weight;
                        $i++;
                    }

                    return $topFans;
                } else {
                    throw new NoResultsException('Artist has no top users');
                }
            } else {
                return false;
            }
        } else {
            throw new InvalidArgumentException('You must include artist varialbe in the call for this method');
        }
    }
public function getTopFans($methodVars)
    {
        // Check for required variables
        if (!empty($methodVars['artist']) || !empty($methodVars['mbid'])) {
            $vars = array(
                'method' => 'artist.gettopfans',
                'api_key' => $this->auth->apiKey
            );
            $vars = array_merge($vars, $methodVars);

            if ($call = $this->apiGetCall($vars)) {
                if (count($call->topfans->user) > 0) {
                    $i = 0;
                    foreach ($call->topfans->user as $user) {
                        $topFans[$i]['name'] = (string) $user->name;
                        $topFans[$i]['url'] = (string) $user->url;
                        $topFans[$i]['image']['small'] = (string) $user->image[0];
                        $topFans[$i]['image']['medium'] = (string) $user->image[1];
                        $topFans[$i]['image']['large'] = (string) $user->image[2];
                        $topFans[$i]['weight'] = (string) $user->weight;
                        $i++;
                    }

                    return $topFans;
                } else {
                    throw new NoResultsException('Artist has no top users');
                }
            } else {
                return false;
            }
        } else {
            throw new InvalidArgumentException('You must include artist varialbe in the call for this method');
        }
    }
public function getTopFans ( $ methodVars ) { // Check for required variables if ( ! empty ( $ methodVars [ 'artist' ] ) || ! empty ( $ methodVars [ 'mbid' ] ) ) { $ vars = array ( 'method' => 'artist.gettopfans' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { if ( count ( $ call -> topfans -> user ) > 0 ) { $ i = 0 ; foreach ( $ call -> topfans -> user as $ user ) { $ topFans [ $ i ] [ 'name' ] = ( string ) $ user -> name ; $ topFans [ $ i ] [ 'url' ] = ( string ) $ user -> url ; $ topFans [ $ i ] [ 'image' ] [ 'small' ] = ( string ) $ user -> image [ 0 ] ; $ topFans [ $ i ] [ 'image' ] [ 'medium' ] = ( string ) $ user -> image [ 1 ] ; $ topFans [ $ i ] [ 'image' ] [ 'large' ] = ( string ) $ user -> image [ 2 ] ; $ topFans [ $ i ] [ 'weight' ] = ( string ) $ user -> weight ; $ i ++ ; } return $ topFans ; } else { throw new NoResultsException ( 'Artist has no top users' ) ; } } else { return false ; } } else { throw new InvalidArgumentException ( 'You must include artist varialbe in the call for this method' ) ; } }
Get the top fans for an artist on Last.fm, based on listening data
@deprecated as of march 15 2016, 'artist.gettopfans' service is not available
@param array $methodVars An array with the following required values: <i>artist</i>
@return array
Get the top fans for an artist on Last . fm based on listening data