X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=vendor%2Fsymfony%2Fhttp-kernel%2FEventListener%2FSessionListener.php;h=39ebfd922fac67befd4d89a18cef153533ea14b2;hb=5b8bb166bfa98770daef9de5c127fc2e6ef02340;hp=2d6adfa0122d2b4d25c084f3a06dde15b044c969;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/vendor/symfony/http-kernel/EventListener/SessionListener.php b/vendor/symfony/http-kernel/EventListener/SessionListener.php index 2d6adfa01..39ebfd922 100644 --- a/vendor/symfony/http-kernel/EventListener/SessionListener.php +++ b/vendor/symfony/http-kernel/EventListener/SessionListener.php @@ -11,44 +11,30 @@ namespace Symfony\Component\HttpKernel\EventListener; -use Symfony\Component\HttpFoundation\Session\SessionInterface; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Psr\Container\ContainerInterface; /** * Sets the session in the request. * - * @author Johannes M. Schmitt + * @author Fabien Potencier + * + * @final since version 3.3 */ -abstract class SessionListener implements EventSubscriberInterface +class SessionListener extends AbstractSessionListener { - public function onKernelRequest(GetResponseEvent $event) + private $container; + + public function __construct(ContainerInterface $container) { - if (!$event->isMasterRequest()) { - return; - } + $this->container = $container; + } - $request = $event->getRequest(); - $session = $this->getSession(); - if (null === $session || $request->hasSession()) { + protected function getSession() + { + if (!$this->container->has('session')) { return; } - $request->setSession($session); + return $this->container->get('session'); } - - public static function getSubscribedEvents() - { - return array( - KernelEvents::REQUEST => array('onKernelRequest', 128), - ); - } - - /** - * Gets the session object. - * - * @return SessionInterface|null A SessionInterface instance or null if no session is available - */ - abstract protected function getSession(); }