You are here

public function TwitterAPIExchange::__construct in Heartbeat 8

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

modules/statusmessage/includes/TwitterAPIExchange.php, line 80

Class

TwitterAPIExchange
Twitter-API-PHP : Simple PHP wrapper for the v1.1 API

Code

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'];
}