Skip to content

Commit 66f35c7

Browse files
authored
Merge pull request #28 from matyx/guzzle-client
Allow passing guzzleClient in options
2 parents e78f3d2 + bb59732 commit 66f35c7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/RecommApi/Client.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ public function __construct($account, $token, $options = array()) {
4646
$this->base_uri = $this->getBaseUri();
4747
$this->user_agent = $this->getUserAgent();
4848

49-
$this->guzzle_client = new \GuzzleHttp\Client();
49+
if (isset($options['guzzleClient'])) {
50+
if (!($options['guzzleClient'] instanceof \GuzzleHttp\ClientInterface)) throw new \InvalidArgumentException("option guzzleClient must be instance of \GuzzleHttp\ClientInterface.");
51+
$this->guzzle_client = $options['guzzleClient'];
52+
} else {
53+
$this->guzzle_client = new \GuzzleHttp\Client();
54+
}
5055
}
5156

5257
protected function getRegionalBaseUri($region) {

0 commit comments

Comments
 (0)