private function determineSuccess($response, $formattedResponse, $timeout)
    {
        $status = $this->findHTTPStatus($response, $formattedResponse);

        if ($status >= 200 && $status <= 299) {
            $this->request_successful = true;
            return true;
        }

        if (isset($formattedResponse['detail'])) {
            $this->last_error = sprintf('%d: %s', $formattedResponse['status'], $formattedResponse['detail']);
            return false;
        }

        if ($timeout > 0 && $response['headers'] && $response['headers']['total_time'] >= $timeout) {
            $this->last_error = sprintf('Request timed out after %f seconds.', $response['headers']['total_time']);
            return false;
        }

        $this->last_error = 'Unknown error, call getLastResponse() to find out what happened.';
        return false;
    }
private function determineSuccess($response, $formattedResponse, $timeout)
    {
        $status = $this->findHTTPStatus($response, $formattedResponse);

        if ($status >= 200 && $status <= 299) {
            $this->request_successful = true;
            return true;
        }

        if (isset($formattedResponse['detail'])) {
            $this->last_error = sprintf('%d: %s', $formattedResponse['status'], $formattedResponse['detail']);
            return false;
        }

        if ($timeout > 0 && $response['headers'] && $response['headers']['total_time'] >= $timeout) {
            $this->last_error = sprintf('Request timed out after %f seconds.', $response['headers']['total_time']);
            return false;
        }

        $this->last_error = 'Unknown error, call getLastResponse() to find out what happened.';
        return false;
    }
private function determineSuccess ( $ response , $ formattedResponse , $ timeout ) { $ status = $ this -> findHTTPStatus ( $ response , $ formattedResponse ) ; if ( $ status >= 200 && $ status <= 299 ) { $ this -> request_successful = true ; return true ; } if ( isset ( $ formattedResponse [ 'detail' ] ) ) { $ this -> last_error = sprintf ( '%d: %s' , $ formattedResponse [ 'status' ] , $ formattedResponse [ 'detail' ] ) ; return false ; } if ( $ timeout > 0 && $ response [ 'headers' ] && $ response [ 'headers' ] [ 'total_time' ] >= $ timeout ) { $ this -> last_error = sprintf ( 'Request timed out after %f seconds.' , $ response [ 'headers' ] [ 'total_time' ] ) ; return false ; } $ this -> last_error = 'Unknown error, call getLastResponse() to find out what happened.' ; return false ; }
Check if the response was successful or a failure. If it failed, store the error.

@param array       $response          The response from the curl request
@param array|false $formattedResponse The response body payload from the curl request
@param int         $timeout           The timeout supplied to the curl request.

@return bool     If the request was successful
Check if the response was successful or a failure . If it failed store the error .