]> Raphaël G. Git Repositories - packbundle/commitdiff
Fix pack filter args
authorRaphaël Gertz <git@rapsys.eu>
Tue, 3 Apr 2018 14:19:21 +0000 (16:19 +0200)
committerRaphaël Gertz <git@rapsys.eu>
Tue, 3 Apr 2018 14:19:21 +0000 (16:19 +0200)
Twig/Filter/CPackFilter.php
Twig/Filter/JPackFilter.php

index 806385a5a438ad5bb40f057b472abc79acc9941c..2edb1c4270a7978d96108fc10f9f72eb01c16017 100644 (file)
@@ -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
index 7e1d5c67ba94b6112638794cf24c407784ffbd80..199d980fa0d76d1250187b64e4f99f4848fe37c6 100644 (file)
@@ -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