/** * @param string $method * @param string $uri * @param mixed $body request body to json encode. * * @return mixed * * @throws FenrirApiException on non success status code. */ private function jsonCall($method, $uri, $body = null) { $jsonBody = null; if (null !== $body) { $jsonBody = json_encode($body); } $request = new Request($method, $uri, ['Content-Type' => 'application/json'], $jsonBody); $response = $this->guzzle->send($request); $this->lastResponse = $response; self::checkResponse($response); return json_decode($response->getBody()); }