protected function whitespaceInInlineElements($contents, PlaceholderContainer $placeholderContainer)
    {
        $elementsRegex = $this->getInlineElementsRegex();

        return preg_replace_callback(
            '/
                (
                    <('.$elementsRegex.')   # Match an inline element
                    (?:(?!<\/\2>).*)        # Match everything except its end tag
                    <\/\2>                  # Match the end tag
                    \s+
                )
                <('.$elementsRegex.')       # Match starting tag
            /xis',
            function ($match) use ($placeholderContainer) {
                return $this->replaceWhitespacesInInlineElements($match[1], $placeholderContainer).'<'.$match[3];
            }, $contents);
    }
protected function whitespaceInInlineElements($contents, PlaceholderContainer $placeholderContainer)
    {
        $elementsRegex = $this->getInlineElementsRegex();

        return preg_replace_callback(
            '/
                (
                    <('.$elementsRegex.')   # Match an inline element
                    (?:(?!<\/\2>).*)        # Match everything except its end tag
                    <\/\2>                  # Match the end tag
                    \s+
                )
                <('.$elementsRegex.')       # Match starting tag
            /xis',
            function ($match) use ($placeholderContainer) {
                return $this->replaceWhitespacesInInlineElements($match[1], $placeholderContainer).'<'.$match[3];
            }, $contents);
    }
protected function whitespaceInInlineElements ( $ contents , PlaceholderContainer $ placeholderContainer ) { $ elementsRegex = $ this -> getInlineElementsRegex ( ) ; return preg_replace_callback ( '/
                (
                    <(' . $ elementsRegex . ')   # Match an inline element
                    (?:(?!<\/\2>).*)        # Match everything except its end tag
                    <\/\2>                  # Match the end tag
                    \s+
                )
                <(' . $ elementsRegex . ')       # Match starting tag
            /xis' , function ( $ match ) use ( $ placeholderContainer ) { return $ this -> replaceWhitespacesInInlineElements ( $ match [ 1 ] , $ placeholderContainer ) . '<' . $ match [ 3 ] ; } , $ contents ) ; }
Whitespaces in an inline element have a function so we replace it.

@param string $contents
@param \ArjanSchouten\HtmlMinifier\PlaceholderContainer $placeholderContainer

@return string
Whitespaces in an inline element have a function so we replace it .