You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.2 KiB

3 years ago
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\HttpKernel\Event;
  11. use Symfony\Component\HttpFoundation\Request;
  12. use Symfony\Component\HttpFoundation\Response;
  13. use Symfony\Component\HttpKernel\HttpKernelInterface;
  14. /**
  15. * Allows to filter a Response object.
  16. *
  17. * You can call getResponse() to retrieve the current response. With
  18. * setResponse() you can set a new response that will be returned to the
  19. * browser.
  20. *
  21. * @author Bernhard Schussek <bschussek@gmail.com>
  22. */
  23. final class ResponseEvent extends KernelEvent
  24. {
  25. private $response;
  26. public function __construct(HttpKernelInterface $kernel, Request $request, int $requestType, Response $response)
  27. {
  28. parent::__construct($kernel, $request, $requestType);
  29. $this->setResponse($response);
  30. }
  31. public function getResponse(): Response
  32. {
  33. return $this->response;
  34. }
  35. public function setResponse(Response $response): void
  36. {
  37. $this->response = $response;
  38. }
  39. }