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

  1.  * (c) Fabien Potencier <fabien@symfony.com>
  2.  *
  3.  * For the full copyright and license information, please view the LICENSE
  4.  * file that was distributed with this source code.
  5.  */
  6. namespace Symfony\Component\HttpKernel\EventListener;
  7. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  8. /**
  9.  * Sets the session in the request.
  10.  *
  11.  * @author Fabien Potencier <fabien@symfony.com>
  12.  *
  13.  * @final
  14.  */
  15. class SessionListener extends AbstractSessionListener
  16. {
  17.     protected function getSession(): ?SessionInterface
  18.     {
  19.         if ($this->container->has('session_factory')) {
  20.             return $this->container->get('session_factory')->createSession();
  21.         }
  22.         return null;
  23.     }
  24. }