本文整理汇总了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']);
}
}