vendor/snc/redis-bundle/SncRedisBundle.php line 24

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the SncRedisBundle package.
  4.  *
  5.  * (c) Henrik Westphal <henrik.westphal@gmail.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 Snc\RedisBundle;
  11. use Snc\RedisBundle\DependencyInjection\Compiler\ClientLocatorPass;
  12. use Snc\RedisBundle\DependencyInjection\Compiler\LoggingPass;
  13. use Snc\RedisBundle\DependencyInjection\Compiler\MonologPass;
  14. use Snc\RedisBundle\DependencyInjection\Compiler\SwiftMailerPass;
  15. use Symfony\Component\DependencyInjection\ContainerBuilder;
  16. use Symfony\Component\HttpKernel\Bundle\Bundle;
  17. /**
  18.  * SncRedisBundle
  19.  */
  20. class SncRedisBundle extends Bundle
  21. {
  22.     /**
  23.      * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
  24.      */
  25.     public function build(ContainerBuilder $container)
  26.     {
  27.         parent::build($container);
  28.         $container->addCompilerPass(new LoggingPass());
  29.         $container->addCompilerPass(new MonologPass());
  30.         $container->addCompilerPass(new SwiftMailerPass());
  31.         $container->addCompilerPass(new ClientLocatorPass());
  32.     }
  33.     /**
  34.      * {@inheritDoc}
  35.      */
  36.     public function shutdown()
  37.     {
  38.         // Close session handler connection to avoid using up all available connection slots in tests
  39.         if ($this->container->has('snc_redis.session.handler')) {
  40.             if (!method_exists($this->container'initialized') || $this->container->initialized('snc_redis.session.handler')) {
  41.                 $this->container->get('snc_redis.session.handler')->close();
  42.             }
  43.         }
  44.     }
  45. }