X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fsymfony%2Fhttp-kernel%2FEventListener%2FSessionListener.php;fp=vendor%2Fsymfony%2Fhttp-kernel%2FEventListener%2FSessionListener.php;h=39ebfd922fac67befd4d89a18cef153533ea14b2;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hp=2d6adfa0122d2b4d25c084f3a06dde15b044c969;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0;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(); }