Exemple #1
0
 /**
  * Set the request URL, method, and parameters.
  *
  * @param  string  request method
  * @param  string  request URL
  * @param  array   request parameters
  * @uses   OAuth1::parse_url
  */
 public function __construct($method, $url, array $params = NULL)
 {
     if ($method) {
         // Set the request method
         $this->method = strtoupper($method);
     }
     // Separate the URL and query string, which will be used as additional
     // default parameters
     list($url, $default) = OAuth1::parse_url($url);
     // Set the request URL
     $this->url = $url;
     if ($default) {
         // Set the default parameters
         $this->params($default);
     }
     if ($params) {
         // Set the request parameters
         $this->params($params);
     }
     if ($this->required('oauth_version') and !isset($this->params['oauth_version'])) {
         // Set the version of this request
         $this->params['oauth_version'] = OAuth1::$version;
     }
     if ($this->required('oauth_timestamp') and !isset($this->params['oauth_timestamp'])) {
         // Set the timestamp of this request
         $this->params['oauth_timestamp'] = $this->timestamp();
     }
     if ($this->required('oauth_nonce') and !isset($this->params['oauth_nonce'])) {
         // Set the unique nonce of this request
         $this->params['oauth_nonce'] = $this->nonce();
     }
 }