Phue\Transport\Http::getJsonResponse PHP Метод

getJsonResponse() защищенный Метод

Send request
protected getJsonResponse ( string $address, string $method = self::METHOD_GET, stdClass $body = null ) : stdClass
$address string API address
$method string Request method
$body stdClass Post body
Результат stdClass Json body
    protected function getJsonResponse($address, $method = self::METHOD_GET, \stdClass $body = null)
    {
        // Build request url
        $url = "http://{$this->client->getHost()}{$address}";
        // Open connection
        $this->getAdapter()->open();
        // Send and get response
        $results = $this->getAdapter()->send($url, $method, $body ? json_encode($body) : null);
        $status = $this->getAdapter()->getHttpStatusCode();
        $contentType = $this->getAdapter()->getContentType();
        // Throw connection exception if status code isn't 200 or wrong content type
        if ($status != 200 || $contentType != 'application/json') {
            throw new ConnectionException('Connection failure');
        }
        // Parse json results
        $jsonResults = json_decode($results);
        return $jsonResults;
    }