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         #, $prefix = '@RapsysPackBundle/Resources/public/', $cpack = '/usr/local/bin/cpack', $jpack = '/usr/local/bin/jpack' 
  10         #$this->kernel = $kernel; 
  11         public function __construct(FileLocator 
$fileLocator, ContainerInterface 
$containerInterface) { 
  13                 $this->fileLocator 
= $fileLocator; 
  14                 //Set container interface 
  15                 $this->containerInterface 
= $containerInterface; 
  18                 $this->prefix 
= '@RapsysPackBundle/Resources/public/'; 
  21                 $this->coutput 
= 'css/*.pack.css'; 
  23                 $this->joutput 
= 'js/*.pack.js'; 
  26                 $this->cpack 
= '/usr/local/bin/cpack'; 
  28                 $this->jpack 
= '/usr/local/bin/jpack'; 
  31                 if ($containerInterface->hasParameter('rapsys_pack')) { 
  32                         foreach($containerInterface->getParameter('rapsys_pack') as $k => $v) { 
  33                                 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}'),