| @@ 81-102 (lines=22) @@ | ||
| 78 | /** |
|
| 79 | * @return ClientInterface |
|
| 80 | */ |
|
| 81 | protected function getClient() |
|
| 82 | { |
|
| 83 | if (is_null($this->client)) { |
|
| 84 | $defaultOptions = [ |
|
| 85 | 'base_uri' => $this->getServiceUrl(), |
|
| 86 | 'headers' => [ |
|
| 87 | 'Host' => $this->getServiceDomain(), |
|
| 88 | 'Accept' => '*/*', |
|
| 89 | 'Authorization' => $this->getAccessToken(), |
|
| 90 | ] |
|
| 91 | ]; |
|
| 92 | if ($this->getProxy()) { |
|
| 93 | $defaultOptions['proxy'] = $this->getProxy(); |
|
| 94 | } |
|
| 95 | if ($this->getDebug()) { |
|
| 96 | $defaultOptions['debug'] = $this->getDebug(); |
|
| 97 | } |
|
| 98 | $this->client = new Client($defaultOptions); |
|
| 99 | } |
|
| 100 | ||
| 101 | return $this->client; |
|
| 102 | } |
|
| 103 | ||
| 104 | /** |
|
| 105 | * Sends a request |
|
| @@ 270-292 (lines=23) @@ | ||
| 267 | /** |
|
| 268 | * @return ClientInterface |
|
| 269 | */ |
|
| 270 | protected function getClient() |
|
| 271 | { |
|
| 272 | if (is_null($this->client)) { |
|
| 273 | $defaultOptions = [ |
|
| 274 | 'base_uri' => $this->getServiceUrl(), |
|
| 275 | 'headers' => [ |
|
| 276 | 'Authorization' => 'OAuth ' . $this->getAccessToken(), |
|
| 277 | 'Host' => $this->getServiceDomain(), |
|
| 278 | 'User-Agent' => $this->getUserAgent(), |
|
| 279 | 'Accept' => '*/*' |
|
| 280 | ] |
|
| 281 | ]; |
|
| 282 | if ($this->getProxy()) { |
|
| 283 | $defaultOptions['proxy'] = $this->getProxy(); |
|
| 284 | } |
|
| 285 | if ($this->getDebug()) { |
|
| 286 | $defaultOptions['debug'] = $this->getDebug(); |
|
| 287 | } |
|
| 288 | $this->client = new Client($defaultOptions); |
|
| 289 | } |
|
| 290 | ||
| 291 | return $this->client; |
|
| 292 | } |
|
| 293 | ||
| 294 | /** |
|
| 295 | * Sends a request |
|