/** * Constructor. * * @param JRegistry $options Client options object. If the registry contains any headers.* elements, * these will be added to the request headers. * @param BDHttpTransport $transport The HTTP transport object. * * @since 1.0 */ public function __construct(JRegistry $options = null, BDHttpTransport $transport = null) { $this->options = isset($options) ? $options : new JRegistry(); $this->transport = isset($transport) ? $transport : BDHttpFactory::getAvailableDriver($this->options); }
/** * Constructor * * @param JRegistry $params The module parameters * * @since 3.0 */ public function __construct($params) { // Store the module params $this->params = $params; // Start setting up the BDHttp connector $transport = null; // Set up our JRegistry object for the BDHttp connector $options = new JRegistry(); // Set the user agent $options->set('userAgent', 'TweetDisplayBack/3.0'); // Use a 30 second timeout $options->set('timeout', 30); // Include the BabDev library JLoader::registerPrefix('BD', __DIR__ . '/libraries'); // If the user has forced a specific connector, use it, otherwise allow BDHttpFactory to decide $connector = $this->params->get('overrideConnector', null); // If the override is 'no', set to null if ($connector == 'no') { $connector = null; } // Instantiate our BDHttp object $this->connector = BDHttpFactory::getHttp($options, $connector); // Instantiate the bearer token $this->bearer = new BDBearer($this->params, $this->connector); // Store the requested URL scheme $this->scheme = JUri::getInstance()->getScheme(); }