TijsVerkoyen\Twitter\Twitter::friendsList PHP Метод

friendsList() публичный Метод

At this time, results are ordered with the most recent following first — however, this ordering is subject to unannounced change and eventual consistency issues. Results are given in groups of 20 users and multiple "pages" of results can be navigated through using the next_cursor value in subsequent requests. See Using cursors to navigate collections for more information.
public friendsList ( string[optional] $userId = null, string[optional] $screenName = null, int[optional] $cursor = null, bool[optional] $includeEntities = null, bool[optional] $skipStatus = null ) : array
$userId string[optional]
$screenName string[optional]
$cursor int[optional]
$includeEntities bool[optional]
$skipStatus bool[optional]
Результат array
    public function friendsList($userId = null, $screenName = null, $cursor = null, $includeEntities = null, $skipStatus = null)
    {
        // validate
        if ($userId == '' && $screenName == '') {
            throw new Exception('Specify an userId or a screenName.');
        }
        // build parameters
        $parameters = null;
        if ($userId != null) {
            $parameters['user_id'] = (string) $userId;
        }
        if ($screenName != null) {
            $parameters['screen_name'] = (string) $screenName;
        }
        if ($cursor !== null) {
            $parameters['cursor'] = (int) $cursor;
        }
        if ($includeEntities !== null) {
            $parameters['include_user_entities'] = $includeEntities ? 'true' : 'false';
        }
        if ($skipStatus !== null) {
            $parameters['skip_status'] = $skipStatus ? 'true' : 'false';
        }
        // make the call
        return $this->doCall('friends/list.json', $parameters, true);
    }

Usage Example

Пример #1
0
 /**
  * Tests Twitter->friendsList
  */
 public function testFriendsList()
 {
     $response = $this->twitter->friendsList(null, 'tijsverkoyen');
     $this->assertArrayHasKey('users', $response);
     $this->assertArrayHasKey('next_cursor', $response);
     $this->assertArrayHasKey('previous_cursor', $response);
 }
Twitter