Abraham\TwitterOAuth\TwitterOAuth::__construct PHP Method

__construct() public method

Constructor
public __construct ( string $consumerKey, string $consumerSecret, string | null $oauthToken = null, string | null $oauthTokenSecret = null )
$consumerKey string The Application Consumer Key
$consumerSecret string The Application Consumer Secret
$oauthToken string | null The Client Token (optional)
$oauthTokenSecret string | null The Client Token Secret (optional)
    public function __construct($consumerKey, $consumerSecret, $oauthToken = null, $oauthTokenSecret = null)
    {
        $this->resetLastResponse();
        $this->signatureMethod = new HmacSha1();
        $this->consumer = new Consumer($consumerKey, $consumerSecret);
        if (!empty($oauthToken) && !empty($oauthTokenSecret)) {
            $this->token = new Token($oauthToken, $oauthTokenSecret);
        }
        if (empty($oauthToken) && !empty($oauthTokenSecret)) {
            $this->bearer = $oauthTokenSecret;
        }
    }

Usage Example

Exemplo n.º 1
0
 function __construct($consumer_key = NULL, $consumer_secret = NULL, $oauth_token = NULL, $oauth_token_secret = NULL)
 {
     $this->config = Kohana::$config->load('twitterauth');
     parent::__construct($this->config->consumer_key, $this->config->consumer_secret);
 }