a4cfd62587fbf65a5b8028ddc15c51dcd03150fc
[yaffs-website] / http-kernel / Event / FilterControllerEvent.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
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\HttpFoundation\Request;
15 use Symfony\Component\HttpKernel\HttpKernelInterface;
16
17 /**
18  * Allows filtering of a controller callable.
19  *
20  * You can call getController() to retrieve the current controller. With
21  * setController() you can set a new controller that is used in the processing
22  * of the request.
23  *
24  * Controllers should be callables.
25  *
26  * @author Bernhard Schussek <bschussek@gmail.com>
27  */
28 class FilterControllerEvent extends KernelEvent
29 {
30     private $controller;
31
32     public function __construct(HttpKernelInterface $kernel, callable $controller, Request $request, $requestType)
33     {
34         parent::__construct($kernel, $request, $requestType);
35
36         $this->setController($controller);
37     }
38
39     /**
40      * Returns the current controller.
41      *
42      * @return callable
43      */
44     public function getController()
45     {
46         return $this->controller;
47     }
48
49     public function setController(callable $controller)
50     {
51         $this->controller = $controller;
52     }
53 }