|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + * This file is part of the Symfony package. |
| 5 | + * |
| 6 | + * (c) Fabien Potencier <[email protected]> |
| 7 | + * |
| 8 | + * For the full copyright and license information, please view the LICENSE |
| 9 | + * file that was distributed with this source code. |
| 10 | + */ |
| 11 | + |
| 12 | +namespace Symfony\Component\HttpKernel\Event; |
| 13 | + |
| 14 | +use Symfony\Component\HttpKernel\HttpKernelInterface; |
| 15 | +use Symfony\Component\HttpFoundation\Request; |
| 16 | + |
| 17 | +/** |
| 18 | + * Allows filtering of controller arguments. |
| 19 | + * |
| 20 | + * You can call getController() to retrieve the controller and getArguments |
| 21 | + * to retrieve the current arguments. With setArguments() you can replace |
| 22 | + * arguments that are used to call the controller. |
| 23 | + * |
| 24 | + * Arguments set in the event must be compatible with the signature of the |
| 25 | + * controller. |
| 26 | + * |
| 27 | + * @author Christophe Coevoet <[email protected]> |
| 28 | + */ |
| 29 | +class FilterControllerArgumentsEvent extends KernelEvent |
| 30 | +{ |
| 31 | + private $controller; |
| 32 | + private $arguments; |
| 33 | + |
| 34 | + public function __construct(HttpKernelInterface $kernel, callable $controller, array $arguments, Request $request, $requestType) |
| 35 | + { |
| 36 | + parent::__construct($kernel, $request, $requestType); |
| 37 | + |
| 38 | + $this->controller = $controller; |
| 39 | + $this->arguments = $arguments; |
| 40 | + } |
| 41 | + |
| 42 | + /** |
| 43 | + * Returns the current controller. |
| 44 | + * |
| 45 | + * @return callable |
| 46 | + */ |
| 47 | + public function getController() |
| 48 | + { |
| 49 | + return $this->controller; |
| 50 | + } |
| 51 | + |
| 52 | + /** |
| 53 | + * @return array |
| 54 | + */ |
| 55 | + public function getArguments() |
| 56 | + { |
| 57 | + return $this->arguments; |
| 58 | + } |
| 59 | + |
| 60 | + /** |
| 61 | + * @param array $arguments |
| 62 | + */ |
| 63 | + public function setArguments(array $arguments) |
| 64 | + { |
| 65 | + $this->arguments = $arguments; |
| 66 | + } |
| 67 | +} |
0 commit comments