1<?php 2/** 3 * Horde_Service_Twitter_Account class for calling account methods 4 * 5 * Copyright 2009-2017 Horde LLC (http://www.horde.org/) 6 * 7 * @author Michael J. Rubinsky <mrubinsk@horde.org> 8 * @license http://www.horde.org/licenses/bsd BSD 9 * @category Horde 10 * @package Service_Twitter 11 */ 12class Horde_Service_Twitter_Account 13{ 14 /** 15 * Twitter endpoint for account api calls 16 * 17 * @var string 18 */ 19 protected $_endpoint = 'https://api.twitter.com/1.1/account/'; 20 21 /** 22 * The request/response format to use, xml or json. 23 * 24 * @var string 25 */ 26 protected $_format = 'json'; 27 28 /** 29 * 30 * @param Horde_Service_Twitter $twitter 31 */ 32 public function __construct($twitter) 33 { 34 $this->_twitter = $twitter; 35 } 36 37 /** 38 * Used to verify current credentials, and obtain some basic profile 39 * information about the current user. 40 * 41 * http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-account%C2%A0verify_credentials 42 * 43 * @return string JSON reprentation of profile. 44 * @throws Horde_Service_Twitter_Exception 45 */ 46 public function verifyCredentials() 47 { 48 $url = $this->_endpoint . 'verify_credentials.' . $this->_format; 49 return $this->_twitter->request->get($url); 50 } 51 52 /** 53 * Obtain the current user's (if authenticated) or IP address' (if not 54 * authenticated) remaining number of requests left for the hour. 55 * 56 * http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-account%C2%A0rate_limit_status 57 * 58 * @return string JSON representation of result object. 59 */ 60 public function rateLimitStatus() 61 { 62 $url = $this->_endpoint . 'rate_limit_status.' . $this->_format; 63 return $this->_twitter->request->get($url); 64 } 65 66 /** 67 * Ends the current session, invalidates the current auth token if using 68 * OAuth. 69 * 70 * @return string 71 */ 72 public function endSession() 73 { 74 // NOOP - no longer part of the Twitter API, no replacement. 75 } 76 77 /** 78 * Update/reset where twitter sends automatic updates to 79 * (im/sms etc...) 80 * 81 * @TODO 82 * @param string $device 83 * 84 * @return void 85 */ 86 public function updateDeliveryDevice($device = '') 87 { 88 } 89 90 /** 91 * Update user's profile data. 92 * 93 * http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-account%C2%A0update_profile 94 * 95 * @TODO 96 * @param array $profile Profile data see API docs for key-values 97 * 98 * @return string JSON representation of user's updated profile data 99 */ 100 public function updateProfile($profile) 101 { 102 } 103 104} 105