public function TwitterAPIExchange::__construct in Twitter Profile Widget 8
Same name and namespace in other branches
- 8.2 src/Resources/j7mbo/twitter_api_php/TwitterAPIExchange.php \Drupal\twitter_profile_widget\Resources\j7mbo\twitter_api_php\TwitterAPIExchange::__construct()
Create the API access object. Requires an array of settings:: oauth access token, oauth access token secret, consumer key, consumer secret These are all available by creating your own application on dev.twitter.com Requires the cURL library
Parameters
array $settings:
Throws
\RuntimeException When cURL isn't loaded
\InvalidArgumentException When incomplete settings parameters are provided
File
- src/
Resources/ j7mbo/ twitter_api_php/ TwitterAPIExchange.php, line 82
Class
- TwitterAPIExchange
- Twitter-API-PHP : Simple PHP wrapper for the v1.1 API
Namespace
Drupal\twitter_profile_widget\Resources\j7mbo\twitter_api_phpCode
public function __construct(array $settings) {
if (!function_exists('curl_init')) {
throw new RuntimeException('TwitterAPIExchange requires cURL extension to be loaded, see: http://curl.haxx.se/docs/install.html');
}
if (!isset($settings['oauth_access_token']) || !isset($settings['oauth_access_token_secret']) || !isset($settings['consumer_key']) || !isset($settings['consumer_secret'])) {
throw new InvalidArgumentException('Incomplete settings passed to TwitterAPIExchange');
}
$this->oauth_access_token = $settings['oauth_access_token'];
$this->oauth_access_token_secret = $settings['oauth_access_token_secret'];
$this->consumer_key = $settings['consumer_key'];
$this->consumer_secret = $settings['consumer_secret'];
}