DrewM\MailChimp\MailChimp::findHTTPStatus PHP Method

findHTTPStatus() private method

Find the HTTP status code from the headers or API response body
private findHTTPStatus ( array $response, array | false $formattedResponse ) : integer
$response array The response from the curl request
$formattedResponse array | false The response body payload from the curl request
return integer HTTP status code
    private function findHTTPStatus($response, $formattedResponse)
    {
        if (!empty($response['headers']) && isset($response['headers']['http_code'])) {
            return (int) $response['headers']['http_code'];
        }
        if (!empty($response['body']) && isset($formattedResponse['status'])) {
            return (int) $formattedResponse['status'];
        }
        return 418;
    }