public function process(MinifyContext $context)
    {
        Collection::make($this->redundantAttributes)->each(function ($attributes, $element) use (&$context) {
            Collection::make($attributes)->each(function ($value, $attribute) use ($element, &$context) {
                $contents = preg_replace_callback(
                    '/
                        '.$element.'                    # Match the given element
                        ((?!\s*'.$attribute.'\s*=).)*   # Match everything except the given attribute
                        (
                            \s*'.$attribute.'\s*        # Match the attribute
                            =\s*                        # Match the equals sign
                            (["\']?)                    # Match the opening quotes
                            \s*'.$value.'\s*            # Match the value
                            \3?                         # Match the captured opening quotes again
                            \s*
                        )
                    /xis',
                    function ($match) {
                        return $this->removeAttribute($match[0], $match[2]);
                    }, $context->getContents());

                $context->setContents($contents);
            });
        });

        return $context;
    }
public function process(MinifyContext $context)
    {
        Collection::make($this->redundantAttributes)->each(function ($attributes, $element) use (&$context) {
            Collection::make($attributes)->each(function ($value, $attribute) use ($element, &$context) {
                $contents = preg_replace_callback(
                    '/
                        '.$element.'                    # Match the given element
                        ((?!\s*'.$attribute.'\s*=).)*   # Match everything except the given attribute
                        (
                            \s*'.$attribute.'\s*        # Match the attribute
                            =\s*                        # Match the equals sign
                            (["\']?)                    # Match the opening quotes
                            \s*'.$value.'\s*            # Match the value
                            \3?                         # Match the captured opening quotes again
                            \s*
                        )
                    /xis',
                    function ($match) {
                        return $this->removeAttribute($match[0], $match[2]);
                    }, $context->getContents());

                $context->setContents($contents);
            });
        });

        return $context;
    }
public function process ( MinifyContext $ context ) { Collection :: make ( $ this -> redundantAttributes ) -> each ( function ( $ attributes , $ element ) use ( & $ context ) { Collection :: make ( $ attributes ) -> each ( function ( $ value , $ attribute ) use ( $ element , & $ context ) { $ contents = preg_replace_callback ( '/
                        ' . $ element . '                    # Match the given element
                        ((?!\s*' . $ attribute . '\s*=).)*   # Match everything except the given attribute
                        (
                            \s*' . $ attribute . '\s*        # Match the attribute
                            =\s*                        # Match the equals sign
                            (["\']?)                    # Match the opening quotes
                            \s*' . $ value . '\s*            # Match the value
                            \3?                         # Match the captured opening quotes again
                            \s*
                        )
                    /xis' , function ( $ match ) { return $ this -> removeAttribute ( $ match [ 0 ] , $ match [ 2 ] ) ; } , $ context -> getContents ( ) ) ; $ context -> setContents ( $ contents ) ; } ) ; } ) ; return $ context ; }
Minify redundant attributes which are not needed by the browser.

@param \ArjanSchouten\HtmlMinifier\MinifyContext $context

@return \ArjanSchouten\HtmlMinifier\MinifyContext
Minify redundant attributes which are not needed by the browser .