compared with
Version 7 by Jon Whitcraft
on Oct 29, 2008 19:37.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (48)

View Page History
{zone-data:skeletons}
{code:php}
class Zend_Service_Twitter Phly_Twitter extends Zend_Rest_Client
{
/**

/**
* Password
* @var string
*/
/**
* Constructor
*
* @param string $username
* @param string $username $password
* @param string $password
* @return void
*/
/**
* Proxy service methods
*
* @param string $type
* @return Phly_Twitter
* @throws Phly_Twitter_Exception if method is not in method types list
/**
* Method overloading
*
* @param string $method
* @param array $params
* @return mixed
* @throws Phly_Twitter_Exception if unable to find method
/**
* Initialize HTTP authentication
*
* @return void
*/
/**
* Set date header
*
* @param int|string $value
* @return void
*/
* Public Timeline status
*
* @param int $sinceId If set, returns only those since the ID provided
* @return Zend_Rest_Client_Result
*/
public function statusPublicTimeline($sinceId = null)
{
$this->_init();
$path = '/statuses/public_timeline.xml';
if (null !== $sinceId) {
$this->since_id = (int) $sinceId;
}
$response = $this->restGet($path);
return new Zend_Rest_Client_Result($response->getBody());
foreach ($params as $key => $value) {
switch (strtolower($key)) {
case 'id':
$path .= '/' . $value;
break;
$this->_init();
$path = '/statuses/user_timeline';
$_params = array();
foreach ($params as $key => $value) {
switch (strtolower($key)) {
case 'id':
$path .= '/' . $value;
break;
break;
case 'page':
$this->page $_params['page'] = (int) $value;
break;
case 'count':
$count = 20;
}
$this->count $_params['count'] = $count;
break;
default:
}
$path .= '.xml';
$response = $this->restGet($path, $_params);
return new Zend_Rest_Client_Result($response->getBody());
}
*
* @param string $status
* @param int $in_reply_to_status_id
* @return Zend_Rest_Client_Result
* @throws Phly_Twitter_Exception if message is too short or too long
*/
public function statusUpdate($status)
public function statusUpdate($status, $in_reply_to_status_id = null)
{
$this->_init();
}

$data = array(
'status' => $status
);

if(is_numeric($in_reply_to_status_id) && !empty($in_reply_to_status_id)) {
$this->in_reply_to_status_id = $in_reply_to_status_id;
}

//$this->status = $status;
$response = $this->restPost($path, $data);
return new Zend_Rest_Client_Result($response->getBody());
}
* @return Zend_Rest_Client_Result
*/
public function statusReplies($page = 1)
public function statusReplies(array $params = array())
{
$this->_init();
$path = '/statuses/replies.xml';

$_params = array();
foreach ($params as $key => $value) {
switch (strtolower($key)) {
case 'since':
$this->_setDate($value);
break;
case 'since_id':
$_params['since_id'] = (int) $value;
break;
case 'page':
$_params['page'] = (int) $value;
break;
default:
break;
$page = (int) $page; }
if ($page > 1) {
$this->page = $page;
}

$response = $this->restGet($path, $_params);
return new Zend_Rest_Client_Result($response->getBody());
}
$path = '/statuses/destroy/' . (int) $id . '.xml';

$response = $this->restGet($path); $this->restPost($path);
return new Zend_Rest_Client_Result($response->getBody());
}
}

$data = array(
'user' => $user,
'text' => $text,
$this->user = $user; );
$this->text = $text;

$response = $this->restPost($path, $data);
return new Zend_Rest_Client_Result($response->getBody());
}
$path = '/direct_messages/destroy/' . $id . '.xml';

$response = $this->restGet($path); $this->restPost($path);
return new Zend_Rest_Client_Result($response->getBody());
}
$path = '/friendships/create/' . $id . '.xml';

$response = $this->restGet($path); $this->restPost($path);
return new Zend_Rest_Client_Result($response->getBody());
}
$path = '/friendships/destroy/' . $id . '.xml';

$response = $this->restGet($path); $this->restPost($path);
return new Zend_Rest_Client_Result($response->getBody());
}

/**
* Friendship exists
*
* @param int|string $id User ID or name of friend to see if they are your friend
* @return Zend_Rest_Client_result
*/
public function friendshipExists($id)
{
$this->_init();
$path = '/friendships/exists.xml';

$data = array(
'user_a' => $this->getUsername(),
'user_b' => $id
);

$response = $this->restGet($path, $data);
return new Zend_Rest_Client_Result($response->getBody());
}

/**
* Verify Account Credentials
*

/**
* Returns the number of api requests you have left per hour.
*
* @return Zend_Rest_Client_Result
*/
public function accountRateLimitStatus()
{
$this->_init();
$response = $this->restGet('/account/rate_limit_status.xml');
return new Zend_Rest_Client_Result($response->getBody());
}

/**
* Fetch favorites
*
switch (strtolower($key)) {
case 'id':
$path .= '/' . $id; $value;
break;
case 'page':
$path = '/favorites/create/' . (int) $id . '.xml';

$response = $this->restGet($path); $this->restPost($path);
return new Zend_Rest_Client_Result($response->getBody());
}
$path = '/favorites/destroy/' . (int) $id . '.xml';

$response = $this->restGet($path); $this->restPost($path);
return new Zend_Rest_Client_Result($response->getBody());
}