/** * Get the response. * @throws ApiException * @return mixed JSON response */ public function getResponse() { if ($this->status !== 200) { throw new \Exception('Something went wrong... Status: ' . $this->status . ' Body: ' . $this->body); } $jsonRawResponse = json_decode($this->body, true); $jsonResponse = new Response($jsonRawResponse); if ($jsonResponse->getCode() !== 0) { throw new ApiException($jsonResponse->getError(), $jsonResponse->getContext(), $jsonResponse->getCode()); } return $jsonResponse->getContext(); }