vendor/symfony/http-kernel/EventListener/SessionListener.php line 31

  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\Component\HttpKernel\EventListener;
  11. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  12. /**
  13.  * Sets the session in the request.
  14.  *
  15.  * @author Fabien Potencier <fabien@symfony.com>
  16.  *
  17.  * @final
  18.  */
  19. class SessionListener extends AbstractSessionListener
  20. {
  21.     protected function getSession(): ?SessionInterface
  22.     {
  23.         if ($this->container->has('session_factory')) {
  24.             return $this->container->get('session_factory')->createSession();
  25.         }
  26.         return null;
  27.     }
  28. }