DrewM\MailChimp\MailChimp::determineSuccess PHP Method

determineSuccess() private method

Check if the response was successful or a failure. If it failed, store the error.
private determineSuccess ( array $response, array | false $formattedResponse ) : boolean
$response array The response from the curl request
$formattedResponse array | false The response body payload from the curl request
return boolean If the request was successful
    private function determineSuccess($response, $formattedResponse)
    {
        $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;
        }
        $this->last_error = 'Unknown error, call getLastResponse() to find out what happened.';
        return false;
    }