vendor/symfony/twig-bundle/TwigBundle.php line 28

  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Bundle\TwigBundle;
  11. use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExtensionPass;
  12. use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\RuntimeLoaderPass;
  13. use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigEnvironmentPass;
  14. use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigLoaderPass;
  15. use Symfony\Component\Console\Application;
  16. use Symfony\Component\DependencyInjection\Compiler\PassConfig;
  17. use Symfony\Component\DependencyInjection\ContainerBuilder;
  18. use Symfony\Component\HttpKernel\Bundle\Bundle;
  19. /**
  20.  * Bundle.
  21.  *
  22.  * @author Fabien Potencier <fabien@symfony.com>
  23.  */
  24. class TwigBundle extends Bundle
  25. {
  26.     /**
  27.      * @return void
  28.      */
  29.     public function build(ContainerBuilder $container)
  30.     {
  31.         parent::build($container);
  32.         // ExtensionPass must be run before the FragmentRendererPass as it adds tags that are processed later
  33.         $container->addCompilerPass(new ExtensionPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION10);
  34.         $container->addCompilerPass(new TwigEnvironmentPass());
  35.         $container->addCompilerPass(new TwigLoaderPass());
  36.         $container->addCompilerPass(new RuntimeLoaderPass(), PassConfig::TYPE_BEFORE_REMOVING);
  37.     }
  38.     /**
  39.      * @return void
  40.      */
  41.     public function registerCommands(Application $application)
  42.     {
  43.         // noop
  44.     }
  45. }