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

            if ($call = $this->apiGetCall($vars)) {
                $similar = array();
                $i = 0;
                foreach ($call->similarartists->artist as $artist) {
                    $similar[$i]['name'] = (string) $artist->name;
                    $similar[$i]['mbid'] = (string) $artist->mbid;
                    $similar[$i]['match'] = (string) $artist->match;
                    $similar[$i]['url'] = (string) $artist->url;
                    $similar[$i]['image'] = (string) $artist->image;
                    $i++;
                }

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

            if ($call = $this->apiGetCall($vars)) {
                $similar = array();
                $i = 0;
                foreach ($call->similarartists->artist as $artist) {
                    $similar[$i]['name'] = (string) $artist->name;
                    $similar[$i]['mbid'] = (string) $artist->mbid;
                    $similar[$i]['match'] = (string) $artist->match;
                    $similar[$i]['url'] = (string) $artist->url;
                    $similar[$i]['image'] = (string) $artist->image;
                    $i++;
                }

                return $similar;
            } else {
                return false;
            }
        } else {
            throw new InvalidArgumentException('You must include artist variable in the call for this method');
        }
    }
public function getSimilar ( $ methodVars ) { // Check for required variables if ( ! empty ( $ methodVars [ 'artist' ] ) || ! empty ( $ methodVars [ 'mbid' ] ) ) { $ vars = array ( 'method' => 'artist.getsimilar' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( $ call = $ this -> apiGetCall ( $ vars ) ) { $ similar = array ( ) ; $ i = 0 ; foreach ( $ call -> similarartists -> artist as $ artist ) { $ similar [ $ i ] [ 'name' ] = ( string ) $ artist -> name ; $ similar [ $ i ] [ 'mbid' ] = ( string ) $ artist -> mbid ; $ similar [ $ i ] [ 'match' ] = ( string ) $ artist -> match ; $ similar [ $ i ] [ 'url' ] = ( string ) $ artist -> url ; $ similar [ $ i ] [ 'image' ] = ( string ) $ artist -> image ; $ i ++ ; } return $ similar ; } else { return false ; } } else { throw new InvalidArgumentException ( 'You must include artist variable in the call for this method' ) ; } }
Get all the artists similar to this artist
@param array $methodVars An array with the following required value: <i>artist</i> and optional value: <i>limit</i>
@return array
Get all the artists similar to this artist