X-Git-Url: https://git.rapsys.eu/packbundle/blobdiff_plain/da2c20b14bc2802eaf94e07a13ac79aab4cbfa71..06e25924552ccb7dd05880ed38aecd86bbda49e8:/Twig/Filter/JPackFilter.php diff --git a/Twig/Filter/JPackFilter.php b/Twig/Filter/JPackFilter.php index 43aeb86..199d980 100644 --- a/Twig/Filter/JPackFilter.php +++ b/Twig/Filter/JPackFilter.php @@ -4,15 +4,13 @@ namespace Rapsys\PackBundle\Twig\Filter; use Rapsys\PackBundle\Twig\Filter\FilterInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; class JPackFilter implements FilterInterface { //Default bin - private $bin = 'jpack'; + private $bin; //Default compress type - //XXX: can be clean, shrink, obfuscate or best - private $compress = 'best'; + private $compress; //Twig template filename private $fileName; @@ -20,24 +18,21 @@ class JPackFilter implements FilterInterface { //Twig template line private $line; - public function __construct(ContainerInterface $containerInterface, $fileName, $line) { - //Load configuration - if ($containerInterface->hasParameter('rapsys_pack.jpackfilter')) { - if ($parameters = $containerInterface->getParameter('rapsys_pack.jpackfilter')) { - foreach($parameters as $k => $v) { - if (isset($this->$k)) { - $this->$k = $v; - } - } - } - } - + //Configure the object + //XXX: can be clean, shrink, obfuscate or best + public function __construct($fileName, $line, $bin = 'jpack', $compress = 'best') { //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 clean parameter