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

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

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

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

                return $weeklytracks;
            } else {
                return false;
            }
        } else {
            throw new InvalidArgumentException('You must include artist variable in the call for this method');
        }
    }
public function getWeeklyTrackChart ( $ methodVars ) { $ weeklytracks = array ( ) ; // Check for required variables
 if ( ! empty ( $ methodVars [ 'user' ] ) ) { $ vars = array ( 'method' => 'user.getweeklytrackchart' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { $ i = 0 ; foreach ( $ call -> weeklytrackchart -> track as $ track ) { $ weeklytracks [ $ i ] [ 'name' ] = ( string ) $ track -> name ; $ weeklytracks [ $ i ] [ 'rank' ] = ( string ) $ track [ 'rank' ] ; $ weeklytracks [ $ i ] [ 'artist' ] [ 'name' ] = ( string ) $ track -> artist ; $ weeklytracks [ $ i ] [ 'artist' ] [ 'mbid' ] = ( string ) $ track -> artist [ 'mbid' ] ; $ weeklytracks [ $ i ] [ 'mbid' ] = ( string ) $ track -> mbid ; $ weeklytracks [ $ i ] [ 'playcount' ] = ( string ) $ track -> playcount ; $ weeklytracks [ $ i ] [ 'url' ] = ( string ) $ track -> url ; $ i ++ ; } return $ weeklytracks ; } else { return false ; } } else { throw new InvalidArgumentException ( 'You must include artist variable in the call for this method' ) ; } }
Get a track chart for a user profile, for a given date range. If no date range is supplied, it will return the most recent track 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 a track chart for a user profile for a given date range . If no date range is supplied it will return the most recent track chart for this user