|
12 | 12 | use Github\HttpClient\Plugin\PathPrepend; |
13 | 13 | use Http\Client\Common\HttpMethodsClient; |
14 | 14 | use Http\Client\Common\Plugin; |
| 15 | +use Http\Client\HttpClient; |
15 | 16 | use Http\Discovery\UriFactoryDiscovery; |
16 | 17 | use Psr\Cache\CacheItemPoolInterface; |
17 | 18 |
|
@@ -104,14 +105,15 @@ class Client |
104 | 105 | /** |
105 | 106 | * Instantiate a new GitHub client. |
106 | 107 | * |
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 |
110 | 112 | */ |
111 | | - public function __construct(Builder $httpClientBuilder = null, $apiVersion = null, $enterpriseUrl = null) |
| 113 | + public function __construct(HttpClient $httpClient, Builder $httpClientBuilder = null, $apiVersion = null, $enterpriseUrl = null) |
112 | 114 | { |
113 | 115 | $this->responseHistory = new History(); |
114 | | - $this->httpClientBuilder = $builder = $httpClientBuilder ?: new Builder(); |
| 116 | + $this->httpClientBuilder = $builder = $httpClientBuilder ?: new Builder($httpClient); |
115 | 117 |
|
116 | 118 | $builder->addPlugin(new GithubExceptionThrower()); |
117 | 119 | $builder->addPlugin(new Plugin\HistoryPlugin($this->responseHistory)); |
|
0 commit comments