1<?php
2
3/*
4 * This file is part of the Assetic package, an OpenSky project.
5 *
6 * (c) 2010-2014 OpenSky Project Inc
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Assetic\Filter;
13
14use Assetic\Asset\AssetInterface;
15use Assetic\Factory\AssetFactory;
16use CssEmbed\CssEmbed;
17
18/**
19 * A filter that embed url directly into css
20 *
21 * @author Pierre Tachoire <pierre.tachoire@gmail.com>
22 * @link https://github.com/krichprollsch/phpCssEmbed
23 */
24class PhpCssEmbedFilter implements DependencyExtractorInterface
25{
26    private $presets = array();
27
28    public function setPresets(array $presets)
29    {
30        $this->presets = $presets;
31    }
32
33    public function filterLoad(AssetInterface $asset)
34    {
35        $pce = new CssEmbed();
36        if ($dir = $asset->getSourceDirectory()) {
37            $pce->setRootDir($dir);
38        }
39
40        $asset->setContent($pce->embedString($asset->getContent()));
41    }
42
43    public function filterDump(AssetInterface $asset)
44    {
45    }
46
47    public function getChildren(AssetFactory $factory, $content, $loadPath = null)
48    {
49        // todo
50        return array();
51    }
52}
53