Inpsyde\MultilingualPress\Module\Redirect\LanguageNegotiation\AcceptLanguageParser::remove_comment PHP Method

remove_comment() private method

A comment starts with a ( and ends with the first ).
private remove_comment ( string $header ) : string
$header string Accept header string.
return string Accept header without comment.
    private function remove_comment($header)
    {
        $delimiter = '~';
        $delimiter_found = false !== strpos($header, $delimiter);
        if ($delimiter_found) {
            $header = str_replace($delimiter, "\\{$delimiter}", $header);
        }
        $header = preg_replace('~\\([^)]*\\)~', '', $header);
        if ($delimiter_found) {
            $header = str_replace("\\{$delimiter}", $delimiter, $header);
        }
        return trim($header);
    }