Skip to content

Commit

Permalink
Merge pull request #28 from matyx/guzzle-client
Browse files Browse the repository at this point in the history
Allow passing guzzleClient in options
  • Loading branch information
OndraFiedler committed Nov 15, 2022
2 parents e78f3d2 + bb59732 commit 66f35c7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/RecommApi/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ public function __construct($account, $token, $options = array()) {
$this->base_uri = $this->getBaseUri();
$this->user_agent = $this->getUserAgent();

$this->guzzle_client = new \GuzzleHttp\Client();
if (isset($options['guzzleClient'])) {
if (!($options['guzzleClient'] instanceof \GuzzleHttp\ClientInterface)) throw new \InvalidArgumentException("option guzzleClient must be instance of \GuzzleHttp\ClientInterface.");
$this->guzzle_client = $options['guzzleClient'];
} else {
$this->guzzle_client = new \GuzzleHttp\Client();
}
}

protected function getRegionalBaseUri($region) {
Expand Down

0 comments on commit 66f35c7

Please sign in to comment.