You are here

public function DrupalOAuthToken::__construct in OAuth 1.0 7.4

Same name and namespace in other branches
  1. 6.3 includes/DrupalOAuthToken.inc \DrupalOAuthToken::__construct()
  2. 7.3 includes/DrupalOAuthToken.inc \DrupalOAuthToken::__construct()

key = the token secret = the token secret

Overrides OAuthToken::__construct

File

includes/DrupalOAuthToken.inc, line 16

Class

DrupalOAuthToken

Code

public function __construct($key, $secret, $consumer, $params = array()) {
  foreach ($params as $param_key => $value) {
    if (isset($this->{$param_key})) {
      $this->{$param_key} = $value;
    }
  }

  // Backwards compatibility with 6.x-3.0-beta3
  if (empty($consumer) || is_array($consumer)) {
    if (is_array($consumer)) {
      $params = $consumer;
    }
    if (!empty($params['csid'])) {
      $consumer = DrupalOAuthConsumer::loadById($params['csid'], isset($params['services']));
    }
  }
  if (!is_object($consumer)) {
    throw new OAuthException("Needs an associated consumer");
  }
  else {
    $this->consumer = $consumer;
  }
  parent::__construct($key, $secret);
}