예제 #1
0
 /**
  * Send a special request to Search API
  *
  * @param string $endPoint The search API endpoint minus extension
  * @param array  $params   An array of parameters
  *
  * @throws {@link Services_Twitter_Exception} on API/HTTP errors
  * @return object Instance of stdClass of JSON response
  * @see Services_Common::sendRequest()
  */
 protected function sendRequest($endPoint, array $params = array())
 {
     $endPoint = self::$uri . $endPoint . '.' . Services_Twitter::OUTPUT_JSON;
     return parent::sendRequest($endPoint, $params, 'GET', Services_Twitter::OUTPUT_JSON);
 }
예제 #2
0
 /**
  * __call
  *
  * Evidently, PHP considers 'new' a reserved keyword. I really, really 
  * wanted to keep the interface the same across the board and Twitter uses
  * /direct_messages/new so Services_Twitter should use 
  * $foo->direct_messages->new(), which was causing parse errors. This is
  * an ugly hack to work around this issue.
  *
  * @param string $function The API endpoint to call
  * @param array  $args     The arguments for the API endpoint
  * 
  * @throws Services_Twitter_Exception
  * @return object Instance of SimpleXMLElement
  * @see Services_Twitter_DirectMessages::dmNew()
  * @see Services_Twitter_Common::__call()
  */
 public function __call($function, array $args = array())
 {
     switch ($function) {
         case 'new':
             if (!isset($args[0]) || !isset($args[1])) {
                 throw new Services_Twitter_Exception('id and text are required when sending a direct message', Services_Twitter::ERROR_UNKNOWN);
             }
             return $this->dmNew($args[0], $args[1]);
         default:
             return parent::__call($function, $args);
     }
 }