@@ 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 |
@@ 80-101 (lines=22) @@ | ||
77 | /** |
|
78 | * @return ClientInterface |
|
79 | */ |
|
80 | protected function getClient() |
|
81 | { |
|
82 | if (is_null($this->client)) { |
|
83 | $defaultOptions = [ |
|
84 | 'base_uri' => $this->getServiceUrl(), |
|
85 | 'headers' => [ |
|
86 | 'Host' => $this->getServiceDomain(), |
|
87 | 'Accept' => '*/*', |
|
88 | 'Authorization' => $this->getAccessToken(), |
|
89 | ] |
|
90 | ]; |
|
91 | if ($this->getProxy()) { |
|
92 | $defaultOptions['proxy'] = $this->getProxy(); |
|
93 | } |
|
94 | if ($this->getDebug()) { |
|
95 | $defaultOptions['debug'] = $this->getDebug(); |
|
96 | } |
|
97 | $this->client = new Client($defaultOptions); |
|
98 | } |
|
99 | ||
100 | return $this->client; |
|
101 | } |
|
102 | ||
103 | /** |
|
104 | * Sends a request |