/** * Creates a curl http adapter. * * @param \Ivory\HttpAdapter\ConfigurationInterface|null $configuration The configuration. * @param boolean $checkExtension TRUE if the extension should be checked else FALSE. * * @throws \Ivory\HttpAdapter\HttpAdapterException If the check extension is enabled and the curl extension is not loaded. */ public function __construct(ConfigurationInterface $configuration = null, $checkExtension = true) { if ($checkExtension && !function_exists('curl_init')) { throw HttpAdapterException::extensionIsNotLoaded('curl', $this->getName()); } parent::__construct($configuration); }
public function __construct(HttpAdapterInterface $adapter, $useCache = false, $apiKey, $cacheDir = '.cached_responses') { parent::__construct(); $this->adapter = $adapter; $this->useCache = $useCache; $this->apiKey = $apiKey; $this->cacheDir = $cacheDir; }
/** * Creates a Cake http adapter. * * @param \HttpSocket|null $httpSocket The Cake http socket. * @param \Ivory\HttpAdapter\ConfigurationInterface|null $configuration The configuration. */ public function __construct(\HttpSocket $httpSocket = null, ConfigurationInterface $configuration = null) { parent::__construct($configuration); $this->httpSocket = $httpSocket ?: new \HttpSocket(); }
/** * Creates a Cake http adapter. * * @param \Cake\Network\Http\Client|null $client The Cake client. * @param \Ivory\HttpAdapter\ConfigurationInterface|null $configuration The configuration. */ public function __construct(Client $client = null, ConfigurationInterface $configuration = null) { parent::__construct($configuration); $this->client = $client ?: new Client(); }