Skip to content

Commit d60a07c

Browse files
committed
Allow passing additional curl options into the Client constructor.
1 parent 74862ea commit d60a07c

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/Kobas/Client.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,27 @@ class Client
4444
*/
4545
protected $headers;
4646

47+
/**
48+
* @var array
49+
*/
50+
protected $curl_options;
51+
4752
/**
4853
* Client constructor.
4954
* @param Signer $signer
5055
* @param HttpRequest|null $request
5156
* @param array $headers
57+
* @param array $curl_options
5258
*/
53-
public function __construct(Signer $signer, HttpRequest $request = null, $headers = [])
59+
public function __construct(Signer $signer, HttpRequest $request = null, $headers = array(), $curl_options = array())
5460
{
5561
$this->signer = $signer;
5662
if ($request == null) {
5763
$request = new Curl();
5864
}
5965
$this->request = $request;
6066
$this->headers = $headers;
67+
$this->curl_options = $curl_options;
6168
}
6269

6370
/**
@@ -162,6 +169,10 @@ protected function call($http_method, $route, array $params = array(), array $he
162169
->setOption(CURLOPT_FOLLOWLOCATION, true)
163170
->setOption(CURLOPT_ENCODING, '');
164171

172+
foreach($this->curl_options as $option => $value) {
173+
$this->request->setOption($option, $value);
174+
}
175+
165176
if (!$this->ssl_verify_peer) {
166177
$this->request->setOption(CURLOPT_SSL_VERIFYPEER, false);
167178
}

0 commit comments

Comments
 (0)