Пример #1
0
 /**
  * Creates a buzz http adapter.
  *
  * @param \Buzz\Browser|null                             $browser       The buzz browser.
  * @param \Ivory\HttpAdapter\ConfigurationInterface|null $configuration The configuration.
  *
  * @throws \Ivory\HttpAdapter\HttpAdapterException If the browser client is multi curl.
  */
 public function __construct(Browser $browser = null, ConfigurationInterface $configuration = null)
 {
     $browser = $browser ?: new Browser();
     if ($browser->getClient() instanceof MultiCurl) {
         throw HttpAdapterException::doesNotSupportSubAdapter($this->getName(), get_class($browser->getClient()));
     }
     parent::__construct($configuration, $browser->getClient() instanceof AbstractCurl);
     $this->browser = $browser;
 }
Пример #2
0
 /**
  * Creates an httpful http adapter.
  *
  * @param \Ivory\HttpAdapter\ConfigurationInterface|null $configuration The configuration.
  */
 public function __construct(ConfigurationInterface $configuration = null)
 {
     parent::__construct($configuration);
 }
Пример #3
0
 /**
  * Creates a guzzle http http adapter.
  *
  * @param \GuzzleHttp\ClientInterface|null               $client        The guzzle 4 client.
  * @param \Ivory\HttpAdapter\ConfigurationInterface|null $configuration The configuration.
  */
 public function __construct(ClientInterface $client = null, ConfigurationInterface $configuration = null)
 {
     parent::__construct($configuration, false);
     $this->client = $client ?: new Client();
 }