public function call()
{
$client = new Client($this->getGuzzleOptions());
try {
$data = ['headers' => $this->headers, 'body' => $this->body];
if (!empty($this->files)) {
$data['multipart'] = $this->buildMultiPart();
} else {
if (!empty($this->form_params)) {
$data['form_params'] = $this->form_params;
}
}
$response = $client->request($this->method, $this->getUrl(), $data);
$body = (string) $response->getBody();
if (strpos($response->getHeaderLine('content-type'), 'json') !== false) {
return json_decode($body, true);
}
return $body;
} catch (RequestException $e) {
throw $e;
}
}