class ResponseListener in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-kernel/EventListener/ResponseListener.php \Symfony\Component\HttpKernel\EventListener\ResponseListener
ResponseListener fixes the Response headers based on the Request.
@author Fabien Potencier <fabien@symfony.com>
Hierarchy
- class \Symfony\Component\HttpKernel\EventListener\ResponseListener implements EventSubscriberInterface
Expanded class hierarchy of ResponseListener
1 file declares its use of ResponseListener
- ResponseListenerTest.php in vendor/
symfony/ http-kernel/ Tests/ EventListener/ ResponseListenerTest.php
File
- vendor/
symfony/ http-kernel/ EventListener/ ResponseListener.php, line 23
Namespace
Symfony\Component\HttpKernel\EventListenerView source
class ResponseListener implements EventSubscriberInterface {
private $charset;
public function __construct($charset) {
$this->charset = $charset;
}
/**
* Filters the Response.
*
* @param FilterResponseEvent $event A FilterResponseEvent instance
*/
public function onKernelResponse(FilterResponseEvent $event) {
if (!$event
->isMasterRequest()) {
return;
}
$response = $event
->getResponse();
if (null === $response
->getCharset()) {
$response
->setCharset($this->charset);
}
$response
->prepare($event
->getRequest());
}
public static function getSubscribedEvents() {
return array(
KernelEvents::RESPONSE => 'onKernelResponse',
);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ResponseListener:: |
private | property | ||
ResponseListener:: |
public static | function |
Returns an array of event names this subscriber wants to listen to. Overrides EventSubscriberInterface:: |
|
ResponseListener:: |
public | function | Filters the Response. | |
ResponseListener:: |
public | function |