TijsVerkoyen\Twitter\Twitter::favoritesList PHP Method

favoritesList() public method

Returns the 20 most recent Tweets favorited by the authenticating or specified user.
public favoritesList ( string[otpional] $userId = null, string[otpional] $screenName = null, int[optional] $count = 20, string[otpional] $sinceId = null, string[otpional] $maxId = null, bool[optional] $includeEntities = null ) : array
$userId string[otpional]
$screenName string[otpional]
$count int[optional]
$sinceId string[otpional]
$maxId string[otpional]
$includeEntities bool[optional]
return array
    public function favoritesList($userId = null, $screenName = null, $count = 20, $sinceId = null, $maxId = null, $includeEntities = 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 ($count != null) {
            $parameters['count'] = (int) $count;
        }
        if ($sinceId != null) {
            $parameters['since_id'] = (string) $sinceId;
        }
        if ($maxId != null) {
            $parameters['max_id'] = (string) $maxId;
        }
        if ($includeEntities !== null) {
            $parameters['include_entities'] = $includeEntities ? 'true' : 'false';
        }
        // make the call
        return $this->doCall('favorites/list.json', $parameters, true);
    }

Usage Example

 /**
  * Tests Twitter->favoritesList
  */
 public function testFavoritesList()
 {
     $response = $this->twitter->favoritesList(null, 'twitter');
     foreach ($response as $row) {
         $this->isTweet($row);
     }
 }
Twitter