2 // src/Rapsys/PackBundle/Twig/PackExtension.php 
   3 namespace Rapsys\PackBundle\Twig
; 
   5 use Symfony\Component\HttpKernel\Config\FileLocator
; 
   6 use Symfony\Component\DependencyInjection\ContainerInterface
; 
   8 class PackExtension 
extends \Twig_Extension 
{ 
   9         public function __construct(FileLocator 
$fileLocator, ContainerInterface 
$containerInterface) { 
  11                 $this->fileLocator 
= $fileLocator; 
  12                 //Set container interface 
  13                 $this->containerInterface 
= $containerInterface; 
  16                 $this->prefix 
= '@RapsysPackBundle/Resources/public/'; 
  19                 $this->coutput 
= 'css/*.pack.css'; 
  21                 $this->joutput 
= 'js/*.pack.js'; 
  24                 $this->cpack 
= '/usr/local/bin/cpack'; 
  26                 $this->jpack 
= '/usr/local/bin/jpack'; 
  29                 if ($containerInterface->hasParameter('rapsys_pack')) { 
  30                         if ($parameters = $containerInterface->getParameter('rapsys_pack')) { 
  31                                 foreach($parameters as $k => $v) { 
  32                                         if (isset($this->$k)) { 
  40                 $this->prefix 
= $this->fileLocator
->locate($this->prefix
); 
  43         public function getTokenParsers() { 
  45                         new PackTokenParser($this->fileLocator
, $this->containerInterface
, $this->prefix
, 'stylesheets', $this->coutput
, $this->cpack
), 
  46                         new PackTokenParser($this->fileLocator
, $this->containerInterface
, $this->prefix
, 'javascripts', $this->joutput
, $this->jpack
), 
  47                         #new PackTokenParser($this->fileLocator, $this->containerInterface, $this->prefix, 'image', '*.pack.{tld}'),