本文整理匯總了PHP中OAuth::__construct方法的典型用法代碼示例。如果您正苦於以下問題:PHP OAuth::__construct方法的具體用法?PHP OAuth::__construct怎麽用?PHP OAuth::__construct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OAuth
的用法示例。
在下文中一共展示了OAuth::__construct方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* OAuthClient constructor. Assigns the OAuth client configuration.
* @param string $name OAuth client name.
* @param string $details OAuth client details.
* @param string $version OAuth client version.
* @param OAuthClientConfig $config OAuthClientConfig instance.
*/
public function __construct(OAuthClientConfig $config)
{
$this->config = $config;
$consumerKey = $this->config->keys->getConsumerKey();
$consumerSecret = $this->config->keys->getConsumerSecret();
parent::__construct($consumerKey, $consumerSecret);
}
示例2:
/**
* Constructor. will automatically try to authenticate
* the user if the AccessToken object is not set.
*
* @param Consumer A Consumer object.
* @param Request A Request object.
* @param AccessToken A AccessToken object.
*/
function __construct(Consumer $consumer = NULL, Request $request = NULL, AccessToken $accessToken = NULL)
{
parent::__construct($consumer, $request);
if ($accessToken === NULL) {
$accessToken = $this->obtainBearerToken();
}
$this->setAccessToken($accessToken);
}
示例3:
/**
* Constructor. Will automatically try to authenticate
* the user if the AccessToken object is not set.
*
* @param Consumer A Consumer object.
* @param Request A Request object.
* @param AccessToken A AccessToken object.
*/
function __construct(Consumer $consumer = NULL, Request $request = NULL, AccessToken $accessToken = NULL)
{
parent::__construct($consumer, $request);
if ($accessToken === NULL) {
$accessToken = $this->authorize();
}
if ($accessToken instanceof AccessToken) {
$this->accessToken = $accessToken;
} else {
$this->setAccessToken($accessToken['oauth_token'], $accessToken['oauth_token_secret']);
}
}