/** * Initialization hook * * Checks the availability of Curl_http */ protected function _init() { // @codeCoverageIgnoreStart if (!function_exists('curl_init')) { throw new Solarium_Exception('cURL is not available, install it to use the CurlHttp adapter'); } parent::_init(); // @codeCoverageIgnoreEnd }
/** * Initialization hook * * Checks the availability of pecl_http */ protected function _init() { // @codeCoverageIgnoreStart if (!class_exists('HttpRequest', false)) { throw new Solarium_Exception('Pecl_http is not available, install it to use the PeclHttp adapter'); } parent::_init(); // @codeCoverageIgnoreEnd }
/** * Set options * * Overrides any existing values. * * If the options array has an 'options' entry it is forwarded to the * Zend_Http_Client. See the Zend_Http_Clientdocs for the many config * options available. * * The $options param should be an array or an object that has a toArray * method, like Zend_Config * * @param array|object $options * @param boolean $overwrite * @return Solarium_Client_Adapter_ZendHttp Provides fluent interface */ public function setOptions($options, $overwrite = false) { parent::setOptions($options, $overwrite); // forward options to zendHttp instance if (null !== $this->_zendHttp) { // forward timeout setting $adapterOptions = array('timeout' => $this->getTimeout()); // forward adapter options if available if (isset($this->_options['options'])) { $adapterOptions = array_merge($adapterOptions, $this->_options['options']); } $this->_zendHttp->setConfig($adapterOptions); } return $this; }
/** * Create an adapter instance * * The 'adapter' entry in {@link $_options} will be used to create an * adapter instance. This entry can be the default value of * {@link $_options}, a value passed to the constructor or a value set by * using {@link setAdapter()} * * This method is used for lazy-loading the adapter upon first use in * {@link getAdapter()} * * @return void */ protected function _createAdapter() { $adapterClass = $this->getOption('adapter'); $this->_adapter = new $adapterClass(); $this->_adapter->setOptions($this->getOption('adapteroptions')); }