protected function encodeResponse()
    {
        try {
            if (!in_array($this->httpCode, $this->successHttpCodes)) {
                throw new Exception(isset($this->httpErrors[$this->httpCode]) ? $this->httpErrors[$this->httpCode] : 'Undescribed error', $this->httpCode);
            }
        } catch (Exception $e) {
            echo 'Error: ' . $e->getMessage() . PHP_EOL . 'Error code: ' . $e->getCode();
        }

        $this->response = json_decode($this->response, true);
    }