class SurrogateListener in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-kernel/EventListener/SurrogateListener.php \Symfony\Component\HttpKernel\EventListener\SurrogateListener
SurrogateListener adds a Surrogate-Control HTTP header when the Response needs to be parsed for Surrogates.
@author Fabien Potencier <fabien@symfony.com>
Hierarchy
- class \Symfony\Component\HttpKernel\EventListener\SurrogateListener implements EventSubscriberInterface
Expanded class hierarchy of SurrogateListener
1 file declares its use of SurrogateListener
- SurrogateListenerTest.php in vendor/
symfony/ http-kernel/ Tests/ EventListener/ SurrogateListenerTest.php
File
- vendor/
symfony/ http-kernel/ EventListener/ SurrogateListener.php, line 24
Namespace
Symfony\Component\HttpKernel\EventListenerView source
class SurrogateListener implements EventSubscriberInterface {
private $surrogate;
/**
* Constructor.
*
* @param SurrogateInterface $surrogate An SurrogateInterface instance
*/
public function __construct(SurrogateInterface $surrogate = null) {
$this->surrogate = $surrogate;
}
/**
* Filters the Response.
*
* @param FilterResponseEvent $event A FilterResponseEvent instance
*/
public function onKernelResponse(FilterResponseEvent $event) {
if (!$event
->isMasterRequest() || null === $this->surrogate) {
return;
}
$this->surrogate
->addSurrogateControl($event
->getResponse());
}
public static function getSubscribedEvents() {
return array(
KernelEvents::RESPONSE => 'onKernelResponse',
);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SurrogateListener:: |
private | property | ||
SurrogateListener:: |
public static | function |
Returns an array of event names this subscriber wants to listen to. Overrides EventSubscriberInterface:: |
|
SurrogateListener:: |
public | function | Filters the Response. | |
SurrogateListener:: |
public | function | Constructor. |