X-Git-Url: https://git.rapsys.eu/packbundle/blobdiff_plain/da2c20b14bc2802eaf94e07a13ac79aab4cbfa71..717a23620f2cd449698b96b5a1851d7676a5d771:/Twig/Filter/CPackFilter.php diff --git a/Twig/Filter/CPackFilter.php b/Twig/Filter/CPackFilter.php index dff71c9..2edb1c4 100644 --- a/Twig/Filter/CPackFilter.php +++ b/Twig/Filter/CPackFilter.php @@ -4,15 +4,13 @@ namespace Rapsys\PackBundle\Twig\Filter; use Rapsys\PackBundle\Twig\Filter\FilterInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; class CPackFilter implements FilterInterface { //Default bin - private $bin = 'cpack'; + private $bin; //Default compress type - //XXX: can be minify or pretty - private $compress = 'minify'; + private $compress; //Twig template filename private $fileName; @@ -21,24 +19,20 @@ class CPackFilter implements FilterInterface { private $line; //Configure the object - public function __construct(ContainerInterface $containerInterface, $fileName, $line) { - //Load configuration - if ($containerInterface->hasParameter('rapsys_pack.cpackfilter')) { - if ($parameters = $containerInterface->getParameter('rapsys_pack.cpackfilter')) { - foreach($parameters as $k => $v) { - if (isset($this->$k)) { - $this->$k = $v; - } - } - } - } - + //XXX: compress can be minify or pretty + public function __construct($fileName, $line, $bin = 'cpack', $compress = 'minify') { //Set fileName $this->fileName = $fileName; //Set line $this->line = $line; + //Set bin + $this->bin = $bin; + + //Set compress + $this->compress = $compress; + //Deal with compress if (!empty($this->compress)) { //Append minify parameter