/** * Assemble all parameters for a generic OAuth request - i.e. no special * params other than the defaults expected for any OAuth query. * * @param string $url * @param Zend\OAuth\Config $config * @param null|array $serviceProviderParams * @return array */ public function assembleParams( $url, OAuth\Config $config, array $serviceProviderParams = null ) { $params = array( 'oauth_consumer_key' => $config->getConsumerKey(), 'oauth_nonce' => $this->generateNonce(), 'oauth_signature_method' => $config->getSignatureMethod(), 'oauth_timestamp' => $this->generateTimestamp(), 'oauth_version' => $config->getVersion(), ); if ($config->getToken()->getToken() != null) { $params['oauth_token'] = $config->getToken()->getToken(); } if ($serviceProviderParams !== null) { $params = array_merge($params, $serviceProviderParams); } $params['oauth_signature'] = $this->sign( $params, $config->getSignatureMethod(), $config->getConsumerSecret(), $config->getToken()->getTokenSecret(), $config->getRequestMethod(), $url ); return $params; }
/** * Constructor; create a new object with an optional array|Zend_Config * instance containing initialising options. * * @param array|Traversable $options */ public function __construct($options = null) { $this->_config = new Config\StandardConfig(); if ($options !== null) { if ($options instanceof Traversable) { $options = ArrayUtils::iteratorToArray($options); } $this->_config->setOptions($options); } }