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

execute() публичный Метод

Perform CSS optimizations.
public execute ( string[optional] $path = null, string[] $parents = [] ) : string
$path string[optional]
$parents string[] Parent paths, for circular reference checks
Результат string The minified data
    public function execute($path = null, $parents = array())
    {
        $content = '';
        // loop css data (raw data and files)
        foreach ($this->data as $source => $css) {
            /*
             * Let's first take out strings & comments, since we can't just remove
             * whitespace anywhere. If whitespace occurs inside a string, we should
             * leave it alone. E.g.:
             * p { content: "a   test" }
             */
            $this->extractStrings();
            $this->stripComments();
            $css = $this->replace($css);
            $css = $this->stripWhitespace($css);
            $css = $this->shortenHex($css);
            $css = $this->shortenZeroes($css);
            $css = $this->shortenFontWeights($css);
            $css = $this->stripEmptyTags($css);
            // restore the string we've extracted earlier
            $css = $this->restoreExtractedData($css);
            $source = is_int($source) ? '' : $source;
            $parents = $source ? array_merge($parents, array($source)) : $parents;
            $css = $this->combineImports($source, $css, $parents);
            $css = $this->importFiles($source, $css);
            /*
             * If we'll save to a new path, we'll have to fix the relative paths
             * to be relative no longer to the source file, but to the new path.
             * If we don't write to a file, fall back to same path so no
             * conversion happens (because we still want it to go through most
             * of the move code...)
             */
            $converter = new Converter($source, $path ?: $source);
            $css = $this->move($converter, $css);
            // combine css
            $content .= $css;
        }
        $content = $this->moveImportsToTop($content);
        return $content;
    }