菜谱项目

GetResponseForControllerResultEvent.php 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. /**
  14. * Allows to create a response for the return value of a controller.
  15. *
  16. * Call setResponse() to set the response that will be returned for the
  17. * current request. The propagation of this event is stopped as soon as a
  18. * response is set.
  19. *
  20. * @author Bernhard Schussek <bschussek@gmail.com>
  21. */
  22. class GetResponseForControllerResultEvent extends GetResponseEvent
  23. {
  24. /**
  25. * The return value of the controller.
  26. *
  27. * @var mixed
  28. */
  29. private $controllerResult;
  30. public function __construct(HttpKernelInterface $kernel, Request $request, $requestType, $controllerResult)
  31. {
  32. parent::__construct($kernel, $request, $requestType);
  33. $this->controllerResult = $controllerResult;
  34. }
  35. /**
  36. * Returns the return value of the controller.
  37. *
  38. * @return mixed The controller return value
  39. */
  40. public function getControllerResult()
  41. {
  42. return $this->controllerResult;
  43. }
  44. /**
  45. * Assigns the return value of the controller.
  46. *
  47. * @param mixed $controllerResult The controller return value
  48. */
  49. public function setControllerResult($controllerResult)
  50. {
  51. $this->controllerResult = $controllerResult;
  52. }
  53. }