src/lastfmapi/Api/UserApi.php
public function getWeeklyArtistChart($methodVars)
    {
        $weeklyartists = array();
        
        // Check for required variables
        if (!empty($methodVars['user'])) {
            $vars = array(
                'method' => 'user.getweeklyartistchart',
                'api_key' => $this->auth->apiKey
            );
            $vars = array_merge($vars, $methodVars);

            if ($call = $this->apiGetCall($vars)) {
                $i = 0;
                foreach ($call->weeklyartistchart->artist as $artist) {
                    $weeklyartists[$i]['name'] = (string) $artist->name;
                    $weeklyartists[$i]['rank'] = (string) $artist['rank'];
                    $weeklyartists[$i]['mbid'] = (string) $artist->mbid;
                    $weeklyartists[$i]['playcount'] = (string) $artist->playcount;
                    $weeklyartists[$i]['url'] = (string) $artist->url;
                    $i++;
                }

                return $weeklyartists;
            } else {
                return false;
            }
        } else {
            throw new InvalidArgumentException('You must include artist variable in the call for this method');
        }
    }
public function getWeeklyArtistChart($methodVars)
    {
        $weeklyartists = array();
        
        // Check for required variables
        if (!empty($methodVars['user'])) {
            $vars = array(
                'method' => 'user.getweeklyartistchart',
                'api_key' => $this->auth->apiKey
            );
            $vars = array_merge($vars, $methodVars);

            if ($call = $this->apiGetCall($vars)) {
                $i = 0;
                foreach ($call->weeklyartistchart->artist as $artist) {
                    $weeklyartists[$i]['name'] = (string) $artist->name;
                    $weeklyartists[$i]['rank'] = (string) $artist['rank'];
                    $weeklyartists[$i]['mbid'] = (string) $artist->mbid;
                    $weeklyartists[$i]['playcount'] = (string) $artist->playcount;
                    $weeklyartists[$i]['url'] = (string) $artist->url;
                    $i++;
                }

                return $weeklyartists;
            } else {
                return false;
            }
        } else {
            throw new InvalidArgumentException('You must include artist variable in the call for this method');
        }
    }
public function getWeeklyArtistChart ( $ methodVars ) { $ weeklyartists = array ( ) ; // Check for required variables
 if ( ! empty ( $ methodVars [ 'user' ] ) ) { $ vars = array ( 'method' => 'user.getweeklyartistchart' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { $ i = 0 ; foreach ( $ call -> weeklyartistchart -> artist as $ artist ) { $ weeklyartists [ $ i ] [ 'name' ] = ( string ) $ artist -> name ; $ weeklyartists [ $ i ] [ 'rank' ] = ( string ) $ artist [ 'rank' ] ; $ weeklyartists [ $ i ] [ 'mbid' ] = ( string ) $ artist -> mbid ; $ weeklyartists [ $ i ] [ 'playcount' ] = ( string ) $ artist -> playcount ; $ weeklyartists [ $ i ] [ 'url' ] = ( string ) $ artist -> url ; $ i ++ ; } return $ weeklyartists ; } else { return false ; } } else { throw new InvalidArgumentException ( 'You must include artist variable in the call for this method' ) ; } }
Get an artist chart for a user profile, for a given date range. If no date range is supplied, it will return the most recent artist chart for this user
@param array $methodVars An array with the following required values: <i>user</i> and optional values: <i>to</i>, <i>from</i>
@return array
Get an artist chart for a user profile for a given date range . If no date range is supplied it will return the most recent artist chart for this user