private function removeAttributeHelper($tag, $attrName, $attrValue, $allAttr, HtmlMin $htmlMin): bool
    {
        // remove defaults
        if ($htmlMin->isDoRemoveDefaultAttributes()) {
            if ($tag === 'script' && $attrName === 'language' && $attrValue === 'javascript') {
                return true;
            }

            if ($tag === 'form' && $attrName === 'method' && $attrValue === 'get') {
                return true;
            }

            if ($tag === 'input' && $attrName === 'type' && $attrValue === 'text') {
                return true;
            }

            if ($tag === 'area' && $attrName === 'shape' && $attrValue === 'rect') {
                return true;
            }
        }

        // remove deprecated charset-attribute (the browser will use the charset from the HTTP-Header, anyway)
        if ($htmlMin->isDoRemoveDeprecatedScriptCharsetAttribute()) {
            if ($tag === 'script' && $attrName === 'charset' && !isset($allAttr['src'])) {
                return true;
            }
        }

        // remove deprecated anchor-jump
        if ($htmlMin->isDoRemoveDeprecatedAnchorName()) {
            if ($tag === 'a' && $attrName === 'name' && isset($allAttr['id']) && $allAttr['id'] === $attrValue) {
                return true;
            }
        }

        // remove "type=text/css" for css links
        if ($htmlMin->isDoRemoveDeprecatedTypeFromStylesheetLink()) {
            if ($tag === 'link' && $attrName === 'type' && $attrValue === 'text/css' && isset($allAttr['rel']) && $allAttr['rel'] === 'stylesheet') {
                return true;
            }
        }

        // remove deprecated script-mime-types
        if ($htmlMin->isDoRemoveDeprecatedTypeFromScriptTag()) {
            if ($tag === 'script' && $attrName === 'type' && isset($allAttr['src'], self::$executableScriptsMimeTypes[$attrValue])) {
                return true;
            }
        }

        // remove 'value=""' from <input type="text">
        if ($htmlMin->isDoRemoveValueFromEmptyInput()) {
            if ($tag === 'input' && $attrName === 'value' && $attrValue === '' && isset($allAttr['type']) && $allAttr['type'] === 'text') {
                return true;
            }
        }

        // remove some empty attributes
        if ($htmlMin->isDoRemoveEmptyAttributes()) {
            if (\trim($attrValue) === '' && \preg_match('/^(?:class|id|style|title|lang|dir|on(?:focus|blur|change|click|dblclick|mouse(?:down|up|over|move|out)|key(?:press|down|up)))$/', $attrName)) {
                return true;
            }
        }

        return false;
    }
private function removeAttributeHelper($tag, $attrName, $attrValue, $allAttr, HtmlMin $htmlMin): bool
    {
        // remove defaults
        if ($htmlMin->isDoRemoveDefaultAttributes()) {
            if ($tag === 'script' && $attrName === 'language' && $attrValue === 'javascript') {
                return true;
            }

            if ($tag === 'form' && $attrName === 'method' && $attrValue === 'get') {
                return true;
            }

            if ($tag === 'input' && $attrName === 'type' && $attrValue === 'text') {
                return true;
            }

            if ($tag === 'area' && $attrName === 'shape' && $attrValue === 'rect') {
                return true;
            }
        }

        // remove deprecated charset-attribute (the browser will use the charset from the HTTP-Header, anyway)
        if ($htmlMin->isDoRemoveDeprecatedScriptCharsetAttribute()) {
            if ($tag === 'script' && $attrName === 'charset' && !isset($allAttr['src'])) {
                return true;
            }
        }

        // remove deprecated anchor-jump
        if ($htmlMin->isDoRemoveDeprecatedAnchorName()) {
            if ($tag === 'a' && $attrName === 'name' && isset($allAttr['id']) && $allAttr['id'] === $attrValue) {
                return true;
            }
        }

        // remove "type=text/css" for css links
        if ($htmlMin->isDoRemoveDeprecatedTypeFromStylesheetLink()) {
            if ($tag === 'link' && $attrName === 'type' && $attrValue === 'text/css' && isset($allAttr['rel']) && $allAttr['rel'] === 'stylesheet') {
                return true;
            }
        }

        // remove deprecated script-mime-types
        if ($htmlMin->isDoRemoveDeprecatedTypeFromScriptTag()) {
            if ($tag === 'script' && $attrName === 'type' && isset($allAttr['src'], self::$executableScriptsMimeTypes[$attrValue])) {
                return true;
            }
        }

        // remove 'value=""' from <input type="text">
        if ($htmlMin->isDoRemoveValueFromEmptyInput()) {
            if ($tag === 'input' && $attrName === 'value' && $attrValue === '' && isset($allAttr['type']) && $allAttr['type'] === 'text') {
                return true;
            }
        }

        // remove some empty attributes
        if ($htmlMin->isDoRemoveEmptyAttributes()) {
            if (\trim($attrValue) === '' && \preg_match('/^(?:class|id|style|title|lang|dir|on(?:focus|blur|change|click|dblclick|mouse(?:down|up|over|move|out)|key(?:press|down|up)))$/', $attrName)) {
                return true;
            }
        }

        return false;
    }
private function removeAttributeHelper ( $ tag , $ attrName , $ attrValue , $ allAttr , HtmlMin $ htmlMin ) : bool { // remove defaults if ( $ htmlMin -> isDoRemoveDefaultAttributes ( ) ) { if ( $ tag === 'script' && $ attrName === 'language' && $ attrValue === 'javascript' ) { return true ; } if ( $ tag === 'form' && $ attrName === 'method' && $ attrValue === 'get' ) { return true ; } if ( $ tag === 'input' && $ attrName === 'type' && $ attrValue === 'text' ) { return true ; } if ( $ tag === 'area' && $ attrName === 'shape' && $ attrValue === 'rect' ) { return true ; } } // remove deprecated charset-attribute (the browser will use the charset from the HTTP-Header, anyway) if ( $ htmlMin -> isDoRemoveDeprecatedScriptCharsetAttribute ( ) ) { if ( $ tag === 'script' && $ attrName === 'charset' && ! isset ( $ allAttr [ 'src' ] ) ) { return true ; } } // remove deprecated anchor-jump if ( $ htmlMin -> isDoRemoveDeprecatedAnchorName ( ) ) { if ( $ tag === 'a' && $ attrName === 'name' && isset ( $ allAttr [ 'id' ] ) && $ allAttr [ 'id' ] === $ attrValue ) { return true ; } } // remove "type=text/css" for css links if ( $ htmlMin -> isDoRemoveDeprecatedTypeFromStylesheetLink ( ) ) { if ( $ tag === 'link' && $ attrName === 'type' && $ attrValue === 'text/css' && isset ( $ allAttr [ 'rel' ] ) && $ allAttr [ 'rel' ] === 'stylesheet' ) { return true ; } } // remove deprecated script-mime-types if ( $ htmlMin -> isDoRemoveDeprecatedTypeFromScriptTag ( ) ) { if ( $ tag === 'script' && $ attrName === 'type' && isset ( $ allAttr [ 'src' ] , self :: $ executableScriptsMimeTypes [ $ attrValue ] ) ) { return true ; } } // remove 'value=""' from <input type="text"> if ( $ htmlMin -> isDoRemoveValueFromEmptyInput ( ) ) { if ( $ tag === 'input' && $ attrName === 'value' && $ attrValue === '' && isset ( $ allAttr [ 'type' ] ) && $ allAttr [ 'type' ] === 'text' ) { return true ; } } // remove some empty attributes if ( $ htmlMin -> isDoRemoveEmptyAttributes ( ) ) { if ( \ trim ( $ attrValue ) === '' && \ preg_match ( '/^(?:class|id|style|title|lang|dir|on(?:focus|blur|change|click|dblclick|mouse(?:down|up|over|move|out)|key(?:press|down|up)))$/' , $ attrName ) ) { return true ; } } return false ; }
Check if the attribute can be removed.

@param string  $tag
@param string  $attrName
@param string  $attrValue
@param array   $allAttr
@param HtmlMin $htmlMin

@return bool
Check if the attribute can be removed .