Example #1
0
 /**
  * Initialization hook
  *
  * Checks the availability of pecl_http
  *
  * @throws RuntimeException
  */
 protected function init()
 {
     // @codeCoverageIgnoreStart
     if (!class_exists('HttpRequest', false)) {
         throw new RuntimeException('Pecl_http is not available, install it to use the PeclHttp adapter');
     }
     parent::init();
     // @codeCoverageIgnoreEnd
 }
Example #2
0
 /**
  * Initialization hook
  *
  * Checks the availability of Curl_http
  *
  * @throws RuntimeException
  */
 protected function init()
 {
     // @codeCoverageIgnoreStart
     if (!function_exists('curl_init')) {
         throw new RuntimeException('cURL is not available, install it to use the CurlHttp adapter');
     }
     parent::init();
     // @codeCoverageIgnoreEnd
 }
Example #3
0
 /**
  * Initialize.
  *
  * This method is called when the plugin is registered to a client instance
  *
  * @param Client $client
  * @param array  $options
  */
 public function initPlugin($client, $options)
 {
     $this->client = $client;
     parent::__construct($options);
     $this->initPluginType();
 }
Example #4
0
 /**
  * Constructor.
  *
  * If options are passed they will be merged with {@link $options} using
  * the {@link setOptions()} method.
  *
  * If an EventDispatcher instance is provided this will be used instead of creating a new instance
  *
  * @param array|\Zend_Config $options
  * @param EventDispatcher $eventDispatcher
  */
 public function __construct($options = null, $eventDispatcher = null)
 {
     $this->eventDispatcher = $eventDispatcher;
     parent::__construct($options);
 }
Example #5
0
 /**
  * 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 self         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();
         // forward adapter options if available
         if (isset($this->options['options'])) {
             $adapterOptions = array_merge($adapterOptions, $this->options['options']);
         }
         $this->zendHttp->setConfig($adapterOptions);
     }
     return $this;
 }