private static function getMessage(ResponseInterface $response)
    {
        try {
            if ($error = ResponseMediator::getContent($response)['error'] ?? null) {
                if ($message = $error['message'] ?? null) {
                    if ($detail = $error['detail'] ?? null) {
                        return sprintf('%s: %s', $message, strtok($detail, "\n"));
                    } else {
                        return $message;
                    }
                }
            }
        } catch (DecodingFailedException $e) {
            // return nothing
        }
    }
private static function getMessage(ResponseInterface $response)
    {
        try {
            if ($error = ResponseMediator::getContent($response)['error'] ?? null) {
                if ($message = $error['message'] ?? null) {
                    if ($detail = $error['detail'] ?? null) {
                        return sprintf('%s: %s', $message, strtok($detail, "\n"));
                    } else {
                        return $message;
                    }
                }
            }
        } catch (DecodingFailedException $e) {
            // return nothing
        }
    }
private static function getMessage ( ResponseInterface $ response ) { try { if ( $ error = ResponseMediator :: getContent ( $ response ) [ 'error' ] ?? null ) { if ( $ message = $ error [ 'message' ] ?? null ) { if ( $ detail = $ error [ 'detail' ] ?? null ) { return sprintf ( '%s: %s' , $ message , strtok ( $ detail , "\n" ) ) ; } else { return $ message ; } } } } catch ( DecodingFailedException $ e ) { // return nothing } }
Get the error message from the response if present.

@param \Psr\Http\Message\ResponseInterface $response

@return string|null
Get the error message from the response if present .