PostResponseEvent.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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\EventDispatcher\Event;
  13. use Symfony\Component\HttpFoundation\Request;
  14. use Symfony\Component\HttpFoundation\Response;
  15. /**
  16. * Allows to execute logic after a response was sent
  17. *
  18. * @author Jordi Boggiano <j.boggiano@seld.be>
  19. */
  20. class PostResponseEvent extends Event
  21. {
  22. /**
  23. * The kernel in which this event was thrown
  24. * @var HttpKernelInterface
  25. */
  26. private $kernel;
  27. private $request;
  28. private $response;
  29. public function __construct(HttpKernelInterface $kernel, Request $request, Response $response)
  30. {
  31. $this->kernel = $kernel;
  32. $this->request = $request;
  33. $this->response = $response;
  34. }
  35. /**
  36. * Returns the kernel in which this event was thrown.
  37. *
  38. * @return HttpKernelInterface
  39. */
  40. public function getKernel()
  41. {
  42. return $this->kernel;
  43. }
  44. /**
  45. * Returns the request for which this event was thrown.
  46. *
  47. * @return Request
  48. */
  49. public function getRequest()
  50. {
  51. return $this->request;
  52. }
  53. /**
  54. * Returns the response for which this event was thrown.
  55. *
  56. * @return Response
  57. */
  58. public function getResponse()
  59. {
  60. return $this->response;
  61. }
  62. }