@@ 248-270 (lines=23) @@ | ||
245 | /** |
|
246 | * @return ClientInterface |
|
247 | */ |
|
248 | protected function getClient() |
|
249 | { |
|
250 | if (is_null($this->client)) { |
|
251 | $defaultOptions = [ |
|
252 | 'base_uri' => $this->getServiceUrl(), |
|
253 | 'headers' => [ |
|
254 | 'Authorization' => 'OAuth ' . $this->getAccessToken(), |
|
255 | 'Host' => $this->getServiceDomain(), |
|
256 | 'User-Agent' => $this->getUserAgent(), |
|
257 | 'Accept' => '*/*' |
|
258 | ] |
|
259 | ]; |
|
260 | if ($this->getProxy()) { |
|
261 | $defaultOptions['proxy'] = $this->getProxy(); |
|
262 | } |
|
263 | if ($this->getDebug()) { |
|
264 | $defaultOptions['debug'] = $this->getDebug(); |
|
265 | } |
|
266 | $this->client = new Client($defaultOptions); |
|
267 | } |
|
268 | ||
269 | return $this->client; |
|
270 | } |
|
271 | ||
272 | /** |
|
273 | * Sends a request |
@@ 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 |