[ 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\HttpKernel\Event\FilterResponseEvent; 16 use Symfony\Component\HttpKernel\HttpCache\SurrogateInterface; 17 use Symfony\Component\HttpKernel\KernelEvents; 18 19 /** 20 * SurrogateListener adds a Surrogate-Control HTTP header when the Response needs to be parsed for Surrogates. 21 * 22 * @author Fabien Potencier <fabien@symfony.com> 23 */ 24 class SurrogateListener implements EventSubscriberInterface 25 { 26 private $surrogate; 27 28 public function __construct(SurrogateInterface $surrogate = null) 29 { 30 $this->surrogate = $surrogate; 31 } 32 33 /** 34 * Filters the Response. 35 */ 36 public function onKernelResponse(FilterResponseEvent $event) 37 { 38 if (!$event->isMasterRequest() || null === $this->surrogate) { 39 return; 40 } 41 42 $this->surrogate->addSurrogateControl($event->getResponse()); 43 } 44 45 public static function getSubscribedEvents() 46 { 47 return array( 48 KernelEvents::RESPONSE => 'onKernelResponse', 49 ); 50 } 51 }
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 |