Skip to content

Commit ea9063e

Browse files
authored
Merge pull request #21 from hotrush/pr/client-changes
Add config array to client
2 parents d142733 + abf3244 commit ea9063e

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/AbstractClient.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ abstract class AbstractClient
1818
*/
1919
protected $logger;
2020

21+
/**
22+
* @var array
23+
*/
24+
protected $config;
25+
2126
/**
2227
* @var \GuzzleHttp\Client
2328
*/
@@ -28,11 +33,13 @@ abstract class AbstractClient
2833
*
2934
* @param LoopInterface $loop
3035
* @param LoggerInterface $logger
36+
* @param array $config
3137
*/
32-
public function __construct(LoopInterface $loop, LoggerInterface $logger)
38+
public function __construct(LoopInterface $loop, LoggerInterface $logger, array $config = [])
3339
{
3440
$this->loop = $loop;
3541
$this->logger = $logger;
42+
$this->config = $config;
3643
$this->client = $this->createClient();
3744
}
3845

src/Client/Guzzle.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ protected function createClient()
2020
$stack = HandlerStack::create($handler);
2121
$stack->push(Middleware::userAgent());
2222

23-
return new GuzzleClient([
24-
'handler' => $stack,
25-
]);
23+
$config = array_merge($this->config, ['handler' => $stack]);
24+
25+
return new GuzzleClient($config);
2626
}
2727
}

0 commit comments

Comments
 (0)