API Documentation

Service/Twitter.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Service
subpackage
Twitter
version
$Id: Twitter.php 22629 2010-07-18 14:22:49Z padraic $
Classes
Zend_Service_Twitter

Description

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Zend_Service_Twitter

Extends from
Zend_Rest_Client
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Service
subpackage
Twitter
Constants
STATUS_MAX_CHARACTERS
OAUTH_BASE_URI
Properties
$_cookieJar
$_dateFormat
$_username
$_methodType
$_oauthConsumer
$_methodTypes
$_options
$_localHttpClient
Methods
__construct
setLocalHttpClient
getLocalHttpClient
isAuthorised
getUsername
setUsername
__get
__call
_init
_setDate
statusPublicTimeline
statusFriendsTimeline
statusUserTimeline
statusShow
statusUpdate
statusReplies
statusDestroy
userFriends
userFollowers
userShow
directMessageMessages
directMessageSent
directMessageNew
directMessageDestroy
friendshipCreate
friendshipDestroy
friendshipExists
accountVerifyCredentials
accountEndSession
accountRateLimitStatus
favoriteFavorites
favoriteCreate
favoriteDestroy
blockCreate
blockDestroy
blockExists
blockBlocking
_validInteger
_validateScreenName
_prepare
_get
_post
_performPost

Description

Constants

STATUS_MAX_CHARACTERS

 STATUS_MAX_CHARACTERS = '246'

246 is the current limit for a status message, 140 characters are displayed initially, with the remainder linked from the web UI or client. The limit is applied to a html encoded UTF-8 string (i.e. entities are counted in the limit which may appear unusual but is a security measure).

This should be reviewed in the future...

Details

value
246

OAUTH_BASE_URI

 OAUTH_BASE_URI = 'http://twitter.com/oauth'

OAuth Endpoint

Details

value
http://twitter.com/oauth

Properties

$_cookieJar

Zend_Http_CookieJar $_cookieJar = ''

Details

$_cookieJar
Zend_Http_CookieJar
visibility
protected
default
final
false
static
false

$_dateFormat

string $_dateFormat = 'D, d M Y H:i:s T'

Date format for 'since' strings

Details

$_dateFormat
string
visibility
protected
default
D, d M Y H:i:s T
final
false
static
false

$_localHttpClient

Zend_Http_Client $_localHttpClient = 'null'

Local HTTP Client cloned from statically set client

Details

$_localHttpClient
Zend_Http_Client
visibility
protected
default
null
final
false
static
false

$_methodType

string $_methodType = ''

Current method type (for method proxying)

Details

$_methodType
string
visibility
protected
default
final
false
static
false

$_methodTypes

array $_methodTypes = 'array'

Types of API methods

Details

$_methodTypes
array
visibility
protected
default
array
final
false
static
false

$_oauthConsumer

Zend_Oauth_Consumer $_oauthConsumer = 'null'

Zend_Oauth Consumer

Details

$_oauthConsumer
Zend_Oauth_Consumer
visibility
protected
default
null
final
false
static
false

$_options

array $_options = 'array'

Options passed to constructor

Details

$_options
array
visibility
protected
default
array
final
false
static
false

$_username

string $_username = ''

Username

Details

$_username
string
visibility
protected
default
final
false
static
false

Methods

__call

__call( string $method, array $params ) : mixed

Method overloading

Arguments
$method
string
$params
array
Output
mixed
Details
visibility
public
final
false
static
false
throws
if unable to find method

__construct

__construct( array $options = null,  $consumer = null ) : void

Constructor

Arguments
$options
array
Optional options array
$consumer
Details
visibility
public
final
false
static
false

__get

__get( string $type ) : Zend_Service_Twitter

Proxy service methods

Arguments
$type
string
Details
visibility
public
final
false
static
false
throws
If method not in method types list

_get

_get( string $path, array $query = null ) : Zend_Http_Response

Performs an HTTP GET request to the $path.

Arguments
$path
string
$query
array
Array of GET parameters
Details
visibility
protected
final
false
static
false
throws

_init

_init( ) : void

Initialize HTTP authentication

Details
visibility
protected
final
false
static
false

_performPost

_performPost( mixed $method, mixed $data = null ) : Zend_Http_Response

Perform a POST or PUT

Performs a POST or PUT request. Any data provided is set in the HTTP client. String data is pushed in as raw POST data; array or object data is pushed in as POST parameters.

Arguments
$method
mixed
$data
mixed
Details
visibility
protected
final
false
static
false

_post

_post( string $path, mixed $data = null ) : Zend_Http_Response

Performs an HTTP POST request to $path.

Arguments
$path
string
$data
mixed
Raw data to send
Details
visibility
protected
final
false
static
false
throws

_prepare

_prepare( string $path ) : void

Call a remote REST web service URI and return the Zend_Http_Response object

Arguments
$path
string
The path to append to the URI
Details
visibility
protected
final
false
static
false
throws

_setDate

_setDate( int|string $value ) : void

Set date header

Arguments
$value
intstring
Details
visibility
protected
final
false
static
false
deprecated
Not supported by Twitter since April 08, 2009

_validInteger

_validInteger(  $int ) : integer

Protected function to validate that the integer is valid or return a 0

Arguments
$int
Output
integer
Details
visibility
protected
final
false
static
false
throws
if HTTP request fails or times out

_validateScreenName

_validateScreenName( string $name ) : string

Validate a screen name using Twitter rules

Arguments
$name
string
Output
string
Details
visibility
protected
final
false
static
false
throws

accountEndSession

accountEndSession( ) : true

End current session

Output
true
Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out

accountRateLimitStatus

accountRateLimitStatus( ) : Zend_Rest_Client_Result

Returns the number of api requests you have left per hour.

Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out

accountVerifyCredentials

accountVerifyCredentials( ) : Zend_Rest_Client_Result

Verify Account Credentials

Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out

blockBlocking

blockBlocking( integer $page = 1, boolean $returnUserIds = false ) : Zend_Rest_Client_Result

Returns an array of user objects that the authenticating user is blocking

Arguments
$page
integer
Optional. Specifies the page number of the results beginning at 1. A single page contains 20 ids.
$returnUserIds
boolean
Optional. Returns only the userid's instead of the whole user object
Details
visibility
public
final
false
static
false

blockCreate

blockCreate( integer|string $id ) : Zend_Rest_Client_Result

Blocks the user specified in the ID parameter as the authenticating user.

Destroys a friendship to the blocked user if it exists.

Arguments
$id
integerstring
The ID or screen name of a user to block.
Details
visibility
public
final
false
static
false

blockDestroy

blockDestroy( integer|string $id ) : Zend_Rest_Client_Result

Un-blocks the user specified in the ID parameter for the authenticating user

Arguments
$id
integerstring
The ID or screen_name of the user to un-block.
Details
visibility
public
final
false
static
false

blockExists

blockExists( string|integer $id, boolean $returnResult = false ) : Boolean|Zend_Rest_Client_Result

Returns if the authenticating user is blocking a target user.

Arguments
$id
stringinteger
The ID or screen_name of the potentially blocked user.
$returnResult
boolean
Instead of returning a boolean return the rest response from twitter
Output
Boolean|Zend_Rest_Client_Result
Details
visibility
public
final
false
static
false

directMessageDestroy

directMessageDestroy( int $id ) : Zend_Rest_Client_Result

Destroy a direct message

Arguments
$id
int
ID of message to destroy
Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out

directMessageMessages

directMessageMessages( array $params = array ) : Zend_Rest_Client_Result

Retrieve direct messages for the current user

$params may include one or more of the following keys - since_id: return statuses only greater than the one specified - page: return page X of results

Arguments
$params
array
Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out

directMessageNew

directMessageNew( int|string $user, string $text ) : Zend_Rest_Client_Result

Send a direct message to a user

Arguments
$user
intstring
User to whom to send message
$text
string
Message to send to user
Details
visibility
public
final
false
static
false
throws
if message is too short or too long
throws
if HTTP request fails or times out

directMessageSent

directMessageSent( array $params = array ) : Zend_Rest_Client_Result

Retrieve list of direct messages sent by current user

$params may include one or more of the following keys - since_id: return statuses only greater than the one specified - page: return page X of results

Arguments
$params
array
Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out

favoriteCreate

favoriteCreate( int $id ) : Zend_Rest_Client_Result

Mark a status as a favorite

Arguments
$id
int
Status ID you want to mark as a favorite
Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out

favoriteDestroy

favoriteDestroy( int $id ) : Zend_Rest_Client_Result

Remove a favorite

Arguments
$id
int
Status ID you want to de-list as a favorite
Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out

favoriteFavorites

favoriteFavorites( array $params = array ) : Zend_Rest_Client_Result

Fetch favorites

$params may contain one or more of the following: - 'id': Id of a user for whom to fetch favorites - 'page': Retrieve a different page of resuls

Arguments
$params
array
Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out

friendshipCreate

friendshipCreate( int|string $id ) : Zend_Rest_Client_Result

Create friendship

Arguments
$id
intstring
User ID or name of new friend
Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out

friendshipDestroy

friendshipDestroy( int|string $id ) : Zend_Rest_Client_Result

Destroy friendship

Arguments
$id
intstring
User ID or name of friend to remove
Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out

friendshipExists

friendshipExists( int|string $id ) : Zend_Rest_Client_result

Friendship exists

Arguments
$id
intstring
User ID or name of friend to see if they are your friend
Output
Zend_Rest_Client_result
Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out

getLocalHttpClient

getLocalHttpClient( ) : Zend_Http_Client

Get the local HTTP client as distinct from the static HTTP client inherited from Zend_Rest_Client

Details
visibility
public
final
false
static
false

getUsername

getUsername( ) : string

Retrieve username

Output
string
Details
visibility
public
final
false
static
false

isAuthorised

isAuthorised( ) : bool

Checks for an authorised state

Output
bool
Details
visibility
public
final
false
static
false

setLocalHttpClient

setLocalHttpClient( Zend_Http_Client $client ) : self

Set local HTTP client as distinct from the static HTTP client as inherited from Zend_Rest_Client.

Arguments
$client
Zend_Http_Client
Output
self
Details
visibility
public
final
false
static
false

setUsername

setUsername( string $value ) : Zend_Service_Twitter

Set username

Arguments
$value
string
Details
visibility
public
final
false
static
false

statusDestroy

statusDestroy( int $id ) : Zend_Rest_Client_Result

Destroy a status message

Arguments
$id
int
ID of status to destroy
Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out

statusFriendsTimeline

statusFriendsTimeline( array $params = array ) : void

Friend Timeline Status

$params may include one or more of the following keys - id: ID of a friend whose timeline you wish to receive - count: how many statuses to return - since_id: return results only after the specific tweet - page: return page X of results

Arguments
$params
array
Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out

statusPublicTimeline

statusPublicTimeline( ) : Zend_Rest_Client_Result

Public Timeline status

Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out

statusReplies

statusReplies(  $params = array ) : Zend_Rest_Client_Result

Get status replies

$params may include one or more of the following keys - since_id: return results only after the specified tweet id - page: return page X of results

Arguments
$params
Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out

statusShow

statusShow( int $id ) : Zend_Rest_Client_Result

Show a single status

Arguments
$id
int
Id of status to show
Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out

statusUpdate

statusUpdate( string $status,  $inReplyToStatusId = null ) : Zend_Rest_Client_Result

Update user's current status

Arguments
$status
string
$inReplyToStatusId
Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out
throws
if message is too short or too long

statusUserTimeline

statusUserTimeline(  $params = array ) : Zend_Rest_Client_Result

User Timeline status

$params may include one or more of the following keys - id: ID of a friend whose timeline you wish to receive - since_id: return results only after the tweet id specified - page: return page X of results - count: how many statuses to return - max_id: returns only statuses with an ID less than or equal to the specified ID - user_id: specfies the ID of the user for whom to return the user_timeline - screen_name: specfies the screen name of the user for whom to return the user_timeline

Arguments
$params
Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out

userFollowers

userFollowers( bool $lite = false ) : Zend_Rest_Client_Result

User Followers

Arguments
$lite
bool
If true, prevents inline inclusion of current status for followers; defaults to false
Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out

userFriends

userFriends(  $params = array ) : Zend_Rest_Client_Result

User friends

Arguments
$params
Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out

userShow

userShow( int|string $id ) : Zend_Rest_Client_Result

Show extended information on a user

Arguments
$id
intstring
User ID or name
Details
visibility
public
final
false
static
false
throws
if HTTP request fails or times out
Documentation was generated by DocBlox.