Sprockets\Filter\Css::__invoke PHP Метод

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

public __invoke ( $content, $file, $dir, $vars )
    public function __invoke($content, $file, $dir, $vars)
    {
        $base_url = str_repeat('../', substr_count($this->pipeline->getCacheDirectory(), '/'));
        return preg_replace_callback(self::URL_REGEX, function ($match) use($content, $dir, $base_url) {
            if (false !== strpos($match[1], '//')) {
                return 'url(' . $match[1] . ')';
            }
            $file = new File(($dir ? $dir . '/' : '') . $match[1]);
            //XXX maybe we should actually cache the image?
            return 'url(' . preg_replace('/(?<!:)\\/\\//', '/', $base_url . $file->getFilepath()) . ')';
        }, $content);
    }