vendor/friendsofsymfony/http-cache-bundle/src/FOSHttpCacheBundle.php line 23

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the FOSHttpCacheBundle package.
  4.  *
  5.  * (c) FriendsOfSymfony <http://friendsofsymfony.github.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 FOS\HttpCacheBundle;
  11. use FOS\HttpCache\UserContext\ContextProvider;
  12. use FOS\HttpCacheBundle\DependencyInjection\Compiler\HashGeneratorPass;
  13. use FOS\HttpCacheBundle\DependencyInjection\Compiler\LoggerPass;
  14. use FOS\HttpCacheBundle\DependencyInjection\Compiler\SessionListenerPass;
  15. use FOS\HttpCacheBundle\DependencyInjection\Compiler\TagListenerPass;
  16. use Symfony\Component\DependencyInjection\ContainerBuilder;
  17. use Symfony\Component\HttpKernel\Bundle\Bundle;
  18. use Symfony\Component\HttpKernel\Kernel;
  19. class FOSHttpCacheBundle extends Bundle
  20. {
  21.     /**
  22.      * {@inheritdoc}
  23.      */
  24.     public function build(ContainerBuilder $container)
  25.     {
  26.         $container->addCompilerPass(new LoggerPass());
  27.         $container->addCompilerPass(new TagListenerPass());
  28.         $container->addCompilerPass(new HashGeneratorPass());
  29.         if (version_compare(Kernel::VERSION'3.4''>=')
  30.             && version_compare(Kernel::VERSION'4.1''<')
  31.         ) {
  32.             $container->addCompilerPass(new SessionListenerPass());
  33.         }
  34.         // Symfony 3.3 and higher
  35.         if (method_exists($container'registerForAutoconfiguration')) {
  36.             $container
  37.                 ->registerForAutoconfiguration(ContextProvider::class)
  38.                 ->addTag('fos_http_cache.user_context_provider');
  39.         }
  40.     }
  41. }