PostResponseEvent.php 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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\HttpKernel\HttpKernelInterface;
  12. use Symfony\Component\HttpFoundation\Request;
  13. use Symfony\Component\HttpFoundation\Response;
  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. }