PostResponseEvent.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 execute logic after a response was sent.
  16. *
  17. * Since it's only triggered on master requests, the `getRequestType()` method
  18. * will always return the value of `HttpKernelInterface::MASTER_REQUEST`.
  19. *
  20. * @author Jordi Boggiano <j.boggiano@seld.be>
  21. */
  22. class PostResponseEvent extends KernelEvent
  23. {
  24. private $response;
  25. public function __construct(HttpKernelInterface $kernel, Request $request, Response $response)
  26. {
  27. parent::__construct($kernel, $request, HttpKernelInterface::MASTER_REQUEST);
  28. $this->response = $response;
  29. }
  30. /**
  31. * Returns the response for which this event was thrown.
  32. *
  33. * @return Response
  34. */
  35. public function getResponse()
  36. {
  37. return $this->response;
  38. }
  39. }