[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 * This file is part of the Symfony package. 5 * 6 * (c) Fabien Potencier <fabien@symfony.com> 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12 namespace Symfony\Component\HttpKernel\EventListener; 13 14 use Symfony\Component\EventDispatcher\EventSubscriberInterface; 15 use Symfony\Component\HttpFoundation\Session\SessionInterface; 16 use Symfony\Component\HttpKernel\Event\GetResponseEvent; 17 use Symfony\Component\HttpKernel\KernelEvents; 18 19 /** 20 * Sets the session in the request. 21 * 22 * @author Johannes M. Schmitt <schmittjoh@gmail.com> 23 */ 24 abstract class SessionListener implements EventSubscriberInterface 25 { 26 public function onKernelRequest(GetResponseEvent $event) 27 { 28 if (!$event->isMasterRequest()) { 29 return; 30 } 31 32 $request = $event->getRequest(); 33 $session = $this->getSession(); 34 if (null === $session || $request->hasSession()) { 35 return; 36 } 37 38 $request->setSession($session); 39 } 40 41 public static function getSubscribedEvents() 42 { 43 return array( 44 KernelEvents::REQUEST => array('onKernelRequest', 128), 45 ); 46 } 47 48 /** 49 * Gets the session object. 50 * 51 * @return SessionInterface|null A SessionInterface instance or null if no session is available 52 */ 53 abstract protected function getSession(); 54 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |