Skip to content

Commit 511775a

Browse files
committed
Added http client to constructor
1 parent a8f60a1 commit 511775a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/Github/Client.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Github\HttpClient\Plugin\PathPrepend;
1313
use Http\Client\Common\HttpMethodsClient;
1414
use Http\Client\Common\Plugin;
15+
use Http\Client\HttpClient;
1516
use Http\Discovery\UriFactoryDiscovery;
1617
use Psr\Cache\CacheItemPoolInterface;
1718

@@ -104,14 +105,15 @@ class Client
104105
/**
105106
* Instantiate a new GitHub client.
106107
*
107-
* @param Builder|null $httpClient
108-
* @param string|null $apiVersion
109-
* @param string|null $enterpriseUrl
108+
* @param HttpClient|null $httpClient
109+
* @param Builder|null $httpClientBuilder If a builder is provided we assume that $httpClient is added to the builder already.
110+
* @param string|null $apiVersion
111+
* @param string|null $enterpriseUrl
110112
*/
111-
public function __construct(Builder $httpClientBuilder = null, $apiVersion = null, $enterpriseUrl = null)
113+
public function __construct(HttpClient $httpClient, Builder $httpClientBuilder = null, $apiVersion = null, $enterpriseUrl = null)
112114
{
113115
$this->responseHistory = new History();
114-
$this->httpClientBuilder = $builder = $httpClientBuilder ?: new Builder();
116+
$this->httpClientBuilder = $builder = $httpClientBuilder ?: new Builder($httpClient);
115117

116118
$builder->addPlugin(new GithubExceptionThrower());
117119
$builder->addPlugin(new Plugin\HistoryPlugin($this->responseHistory));

0 commit comments

Comments
 (0)