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

            if ($call = $this->apiGetCall($vars)) {
                if (count($call->neighbours->user) > 0) {
                    $i = 0;
                    foreach ($call->neighbours->user as $user) {
                        $neighbours[$i]['name'] = (string) $user->name;
                        $neighbours[$i]['url'] = (string) $user->url;
                        $neighbours[$i]['image'] = (string) $user->image;
                        $neighbours[$i]['match'] = (string) $user->match;
                        $i++;
                    }

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

            if ($call = $this->apiGetCall($vars)) {
                if (count($call->neighbours->user) > 0) {
                    $i = 0;
                    foreach ($call->neighbours->user as $user) {
                        $neighbours[$i]['name'] = (string) $user->name;
                        $neighbours[$i]['url'] = (string) $user->url;
                        $neighbours[$i]['image'] = (string) $user->image;
                        $neighbours[$i]['match'] = (string) $user->match;
                        $i++;
                    }

                    return $neighbours;
                } else {
                    throw new NoResultsException('This user has no neighbours');
                }
            } else {
                return false;
            }
        } else {
            throw new InvalidArgumentException('You must include artist variable in the call for this method');
        }
    }
public function getNeighbours ( $ methodVars ) { // Check for required variables
 if ( ! empty ( $ methodVars [ 'user' ] ) ) { $ vars = array ( 'method' => 'user.getneighbours' , 'api_key' => $ this -> auth -> apiKey ) ; $ vars = array_merge ( $ vars , $ methodVars ) ; if ( ! empty ( $ methodVars [ 'limit' ] ) ) { $ vars [ 'limit' ] = $ methodVars [ 'limit' ] ; } if ( $ call = $ this -> apiGetCall ( $ vars ) ) { if ( count ( $ call -> neighbours -> user ) > 0 ) { $ i = 0 ; foreach ( $ call -> neighbours -> user as $ user ) { $ neighbours [ $ i ] [ 'name' ] = ( string ) $ user -> name ; $ neighbours [ $ i ] [ 'url' ] = ( string ) $ user -> url ; $ neighbours [ $ i ] [ 'image' ] = ( string ) $ user -> image ; $ neighbours [ $ i ] [ 'match' ] = ( string ) $ user -> match ; $ i ++ ; } return $ neighbours ; } else { throw new NoResultsException ( 'This user has no neighbours' ) ; } } else { return false ; } } else { throw new InvalidArgumentException ( 'You must include artist variable in the call for this method' ) ; } }
Get a list of a user's neighbours on Last.fm
@deprecated as of march 15 2016, 'user.getneighbours' method is not available
@param array $methodVars An array with the following required values: <i>user</i>
@return array
Get a list of a user s neighbours on Last . fm