public statusesUserTimeline ( string[optional] $userId = null, string[optional] $screenName = null, string[optional] $sinceId = null, int[optional] $count = null, string[optional] $maxId = null, bool[optional] $trimUser = null, bool[optional] $excludeReplies = null, bool[optional] $contributorDetails = null, bool[optional] $includeRts = null ) : array | ||
$userId | string[optional] | |
$screenName | string[optional] | |
$sinceId | string[optional] | |
$count | int[optional] | |
$maxId | string[optional] | |
$trimUser | bool[optional] | |
$excludeReplies | bool[optional] | |
$contributorDetails | bool[optional] | |
$includeRts | bool[optional] | |
return | array |
public function statusesUserTimeline($userId = null, $screenName = null, $sinceId = null, $count = null, $maxId = null, $trimUser = null, $excludeReplies = null, $contributorDetails = null, $includeRts = 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 ($sinceId != null) {
$parameters['since_id'] = (string) $sinceId;
}
if ($count != null) {
$parameters['count'] = (int) $count;
}
if ($maxId != null) {
$parameters['max_id'] = (string) $maxId;
}
if ($trimUser !== null) {
$parameters['trim_user'] = $trimUser ? 'true' : 'false';
}
if ($excludeReplies !== null) {
$parameters['exclude_replies'] = $excludeReplies ? 'true' : 'false';
}
if ($contributorDetails !== null) {
$parameters['contributor_details'] = $contributorDetails ? 'true' : 'false';
}
if ($includeRts !== null) {
$parameters['include_rts'] = $includeRts ? 'true' : 'false';
}
// make the call
return $this->doCall('statuses/user_timeline.json', $parameters);
}
/** * Tests Twitter->statusesUserTimeline() */ public function testStatusesUserTimeline() { $response = $this->twitter->statusesUserTimeline(null, null, null, 2); $this->assertEquals(count($response), 2); foreach ($response as $row) { $this->isTweet($row); } }