<?php
 
-// src/Rapsys/PackBundle/Twig/Filter/CPackFilter.php
 namespace Rapsys\PackBundle\Twig\Filter;
 
 use Rapsys\PackBundle\Twig\Filter\FilterInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
+use Twig\Error\Error;
 
 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;
        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
                        if ($this->compress == 'minify') {
                                $this->bin .= ' --minify';
                        //Unknown compress type
-                       #XXX: default compression is pretty
+                       //XXX: default compression is pretty
                        } elseif ($this->compress !== 'pretty') {
                                //Throw an error on unknown compress
-                               throw new \Twig_Error(sprintf('Got unexpected compress for %s: %s', $this->bin, $this->compress), $this->line, $this->fileName);
+                               throw new Error(sprintf('Got unexpected compress for %s: %s', $this->bin, $this->compress), $this->line, $this->fileName);
                        }
                }
        }
 
                        //Read content from stderr
                        if (($stderr = stream_get_contents($pipes[2]))) {
-                               throw new \Twig_Error(sprintf('Got unexpected strerr for %s: %s', $this->bin, $stderr), $this->line, $this->fileName);
+                               throw new Error(sprintf('Got unexpected strerr for %s: %s', $this->bin, $stderr), $this->line, $this->fileName);
                        }
 
                        //Close stderr
 
                        //Close process
                        if (($ret = proc_close($proc))) {
-                               throw new \Twig_Error(sprintf('Got unexpected non zero return code %s: %d', $this->bin, $ret), $this->line, $this->fileName);
+                               throw new Error(sprintf('Got unexpected non zero return code %s: %d', $this->bin, $ret), $this->line, $this->fileName);
                        }
                }