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

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\LoggingPass;
  12. use Snc\RedisBundle\DependencyInjection\Compiler\MonologPass;
  13. use Snc\RedisBundle\DependencyInjection\Compiler\SwiftMailerPass;
  14. use Symfony\Component\DependencyInjection\ContainerBuilder;
  15. use Symfony\Component\HttpKernel\Bundle\Bundle;
  16. /**
  17.  * SncRedisBundle
  18.  */
  19. class SncRedisBundle extends Bundle
  20. {
  21.     /**
  22.      * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
  23.      */
  24.     public function build(ContainerBuilder $container)
  25.     {
  26.         parent::build($container);
  27.         $container->addCompilerPass(new LoggingPass());
  28.         $container->addCompilerPass(new MonologPass());
  29.         $container->addCompilerPass(new SwiftMailerPass());
  30.     }
  31.     /**
  32.      * {@inheritDoc}
  33.      */
  34.     public function shutdown()
  35.     {
  36.         // Close session handler connection to avoid using up all available connection slots in tests
  37.         if ($this->container->has('snc_redis.session.handler')) {
  38.             if (!method_exists($this->container'initialized') || $this->container->initialized('snc_redis.session.handler')) {
  39.                 $this->container->get('snc_redis.session.handler')->close();
  40.             }
  41.         }
  42.     }
  43. }