暫無描述

GetResponseEvent.php 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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\Response;
  12. /**
  13. * @deprecated since Symfony 4.3, use RequestEvent instead
  14. */
  15. class GetResponseEvent extends KernelEvent
  16. {
  17. private $response;
  18. /**
  19. * Returns the response object.
  20. *
  21. * @return Response|null
  22. */
  23. public function getResponse()
  24. {
  25. return $this->response;
  26. }
  27. /**
  28. * Sets a response and stops event propagation.
  29. */
  30. public function setResponse(Response $response)
  31. {
  32. $this->response = $response;
  33. $this->stopPropagation();
  34. }
  35. /**
  36. * Returns whether a response was set.
  37. *
  38. * @return bool Whether a response was set
  39. */
  40. public function hasResponse()
  41. {
  42. return null !== $this->response;
  43. }
  44. }