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