MatthiasMullie\Minify\CSS::stripWhitespace PHP Метод

stripWhitespace() защищенный Метод

Strip whitespace.
protected stripWhitespace ( string $content ) : string
$content string The CSS content to strip the whitespace for
Результат string
    protected function stripWhitespace($content)
    {
        // remove leading & trailing whitespace
        $content = preg_replace('/^\\s*/m', '', $content);
        $content = preg_replace('/\\s*$/m', '', $content);
        // replace newlines with a single space
        $content = preg_replace('/\\s+/', ' ', $content);
        // remove whitespace around meta characters
        // inspired by stackoverflow.com/questions/15195750/minify-compress-css-with-regex
        $content = preg_replace('/\\s*([\\*$~^|]?+=|[{};,>~]|!important\\b)\\s*/', '$1', $content);
        $content = preg_replace('/([\\[(:])\\s+/', '$1', $content);
        $content = preg_replace('/\\s+([\\]\\)])/', '$1', $content);
        $content = preg_replace('/\\s+(:)(?![^\\}]*\\{)/', '$1', $content);
        // whitespace around + and - can only be stripped in selectors, like
        // :nth-child(3+2n), not in things like calc(3px + 2px) or shorthands
        // like 3px -2px
        $content = preg_replace('/\\s*([+-])\\s*(?=[^}]*{)/', '$1', $content);
        // remove semicolon/whitespace followed by closing bracket
        $content = str_replace(';}', '}', $content);
        return trim($content);
    }