You are here

public static function OAuthRequest::from_consumer_and_token in jQuery social stream 8.2

Same name and namespace in other branches
  1. 8 src/Twitter/OAuthRequest.php \Drupal\jquery_social_stream\Twitter\OAuthRequest::from_consumer_and_token()

pretty much a helper function to set up the request

1 call to OAuthRequest::from_consumer_and_token()
TwitterOAuth::oAuthRequest in src/Twitter/TwitterOAuth.php
Format and sign an OAuth / API request

File

src/Twitter/OAuthRequest.php, line 77

Class

OAuthRequest

Namespace

Drupal\jquery_social_stream\Twitter

Code

public static function from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters = NULL) {
  @$parameters or $parameters = array();
  $defaults = array(
    "oauth_version" => OAuthRequest::$version,
    "oauth_nonce" => OAuthRequest::generate_nonce(),
    "oauth_timestamp" => OAuthRequest::generate_timestamp(),
    "oauth_consumer_key" => $consumer->key,
  );
  if ($token) {
    $defaults['oauth_token'] = $token->key;
  }
  $parameters = array_merge($defaults, $parameters);
  return new OAuthRequest($http_method, $http_url, $parameters);
}