src/RequestHandler.php
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);
    }
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);
    }
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 ) ; }
Encoding response from json, throw exception in case of wrong http code
Encoding response from json throw exception in case of wrong http code