You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.5 KiB

3 years ago
  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\HttpKernel\HttpKernelInterface;
  13. /**
  14. * Allows filtering of controller arguments.
  15. *
  16. * You can call getController() to retrieve the controller and getArguments
  17. * to retrieve the current arguments. With setArguments() you can replace
  18. * arguments that are used to call the controller.
  19. *
  20. * Arguments set in the event must be compatible with the signature of the
  21. * controller.
  22. *
  23. * @author Christophe Coevoet <stof@notk.org>
  24. */
  25. final class ControllerArgumentsEvent extends KernelEvent
  26. {
  27. private $controller;
  28. private $arguments;
  29. public function __construct(HttpKernelInterface $kernel, callable $controller, array $arguments, Request $request, ?int $requestType)
  30. {
  31. parent::__construct($kernel, $request, $requestType);
  32. $this->controller = $controller;
  33. $this->arguments = $arguments;
  34. }
  35. public function getController(): callable
  36. {
  37. return $this->controller;
  38. }
  39. public function setController(callable $controller)
  40. {
  41. $this->controller = $controller;
  42. }
  43. public function getArguments(): array
  44. {
  45. return $this->arguments;
  46. }
  47. public function setArguments(array $arguments)
  48. {
  49. $this->arguments = $arguments;
  50. }
  51. }