src/lastfmapi/Api/ChartApi.php
public function getTopArtists($methodVars)
    {
        $vars = array(
            'method' => 'chart.gettopartists',
            'api_key' => $this->auth->apiKey
        );
        $vars = array_merge($vars, $methodVars);

        if ($call = $this->apiGetCall($vars)) {
            $i = 0;
            foreach ($call->artists->artist as $artist) {
                $topArtists[$i]['name'] = (string) $artist->name;
                $topArtists[$i]['playcount'] = (string) $artist->playcount;
                $topArtists[$i]['listeners'] = (string) $artist->listeners;
                $topArtists[$i]['mbid'] = (string) $artist->mbid;
                $topArtists[$i]['url'] = (string) $artist->url;
                $topArtists[$i]['streamable'] = (string) $artist->streamable;
                $topArtists[$i]['image']['small'] = (string) $artist->image[0];
                $topArtists[$i]['image']['medium'] = (string) $artist->image[1];
                $topArtists[$i]['image']['large'] = (string) $artist->image[2];
                $topArtists[$i]['image']['extralarge'] = (string) $artist->image[3];
                $topArtists[$i]['image']['mega'] = (string) $artist->image[4];
                $i++;
            }

            return $topArtists;
        } else {
            return false;
        }
    }
public function getTopArtists($methodVars)
    {
        $vars = array(
            'method' => 'chart.gettopartists',
            'api_key' => $this->auth->apiKey
        );
        $vars = array_merge($vars, $methodVars);

        if ($call = $this->apiGetCall($vars)) {
            $i = 0;
            foreach ($call->artists->artist as $artist) {
                $topArtists[$i]['name'] = (string) $artist->name;
                $topArtists[$i]['playcount'] = (string) $artist->playcount;
                $topArtists[$i]['listeners'] = (string) $artist->listeners;
                $topArtists[$i]['mbid'] = (string) $artist->mbid;
                $topArtists[$i]['url'] = (string) $artist->url;
                $topArtists[$i]['streamable'] = (string) $artist->streamable;
                $topArtists[$i]['image']['small'] = (string) $artist->image[0];
                $topArtists[$i]['image']['medium'] = (string) $artist->image[1];
                $topArtists[$i]['image']['large'] = (string) $artist->image[2];
                $topArtists[$i]['image']['extralarge'] = (string) $artist->image[3];
                $topArtists[$i]['image']['mega'] = (string) $artist->image[4];
                $i++;
            }

            return $topArtists;
        } else {
            return false;
        }
    }
public function getTopArtists ( $ methodVars ) { $ vars = array ( 'method' => 'chart.gettopartists' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { $ i = 0 ; foreach ( $ call -> artists -> artist as $ artist ) { $ topArtists [ $ i ] [ 'name' ] = ( string ) $ artist -> name ; $ topArtists [ $ i ] [ 'playcount' ] = ( string ) $ artist -> playcount ; $ topArtists [ $ i ] [ 'listeners' ] = ( string ) $ artist -> listeners ; $ topArtists [ $ i ] [ 'mbid' ] = ( string ) $ artist -> mbid ; $ topArtists [ $ i ] [ 'url' ] = ( string ) $ artist -> url ; $ topArtists [ $ i ] [ 'streamable' ] = ( string ) $ artist -> streamable ; $ topArtists [ $ i ] [ 'image' ] [ 'small' ] = ( string ) $ artist -> image [ 0 ] ; $ topArtists [ $ i ] [ 'image' ] [ 'medium' ] = ( string ) $ artist -> image [ 1 ] ; $ topArtists [ $ i ] [ 'image' ] [ 'large' ] = ( string ) $ artist -> image [ 2 ] ; $ topArtists [ $ i ] [ 'image' ] [ 'extralarge' ] = ( string ) $ artist -> image [ 3 ] ; $ topArtists [ $ i ] [ 'image' ] [ 'mega' ] = ( string ) $ artist -> image [ 4 ] ; $ i ++ ; } return $ topArtists ; } else { return false ; } }
Get the top artists chart
@param array $methodVars An array with the optional value: <i>limit</i>, <i>page</i>
@return array|false
Get the top artists chart