class FilterResponseEvent

Allows to filter a Response object

You can call getResponse() to retrieve the current response. With setResponse() you can set a new response that will be returned to the browser.

@author Bernhard Schussek <bschussek@gmail.com>

@api

Hierarchy

Expanded class hierarchy of FilterResponseEvent

10 files declare their use of FilterResponseEvent
EsiListener.php in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/EsiListener.php
EsiListenerTest.php in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/EsiListenerTest.php
FinishResponseSubscriber.php in drupal/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php
Definition of Drupal\Core\EventSubscriber\FinishResponseSubscriber.
HttpKernel.php in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php
OverlaySubscriber.php in drupal/core/modules/overlay/lib/Drupal/overlay/EventSubscriber/OverlaySubscriber.php
Contains \Drupal\overlay\EventSubscriber\OverlaySubscriber.

... See full list

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/FilterResponseEvent.php, line 29

Namespace

Symfony\Component\HttpKernel\Event
View source
class FilterResponseEvent extends KernelEvent {

  /**
   * The current response object
   * @var Response
   */
  private $response;
  public function __construct(HttpKernelInterface $kernel, Request $request, $requestType, Response $response) {
    parent::__construct($kernel, $request, $requestType);
    $this
      ->setResponse($response);
  }

  /**
   * Returns the current response object
   *
   * @return Response
   *
   * @api
   */
  public function getResponse() {
    return $this->response;
  }

  /**
   * Sets a new response object
   *
   * @param Response $response
   *
   * @api
   */
  public function setResponse(Response $response) {
    $this->response = $response;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Event::$dispatcher private property
Event::$name private property
Event::$propagationStopped private property
Event::getDispatcher public function Returns the EventDispatcher that dispatches this Event
Event::getName public function Gets the event's name.
Event::isPropagationStopped public function Returns whether further event listeners should be triggered.
Event::setDispatcher public function Stores the EventDispatcher that dispatches this Event
Event::setName public function Sets the event's name property.
Event::stopPropagation public function Stops the propagation of the event to further event listeners.
FilterResponseEvent::$response private property The current response object
FilterResponseEvent::getResponse public function Returns the current response object
FilterResponseEvent::setResponse public function Sets a new response object
FilterResponseEvent::__construct public function Overrides KernelEvent::__construct
KernelEvent::$kernel private property The kernel in which this event was thrown
KernelEvent::$request private property The request the kernel is currently processing
KernelEvent::$requestType private property The request type the kernel is currently processing. One of HttpKernelInterface::MASTER_REQUEST and HttpKernelInterface::SUB_REQUEST
KernelEvent::getKernel public function Returns the kernel in which this event was thrown
KernelEvent::getRequest public function Returns the request the kernel is currently processing
KernelEvent::getRequestType public function Returns the request type the kernel is currently processing