1: <?php
2: /**
3: * This file is part of the Autarky package.
4: *
5: * (c) Andreas Lutro <anlutro@gmail.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:
11: namespace Autarky\Routing\Events;
12:
13: /**
14: * Event that is fired before a route's controller is invoked.
15: */
16: class BeforeEvent extends AbstractRouteEvent
17: {
18: /**
19: * @var callable|null
20: */
21: protected $controller;
22:
23: /**
24: * @var mixed
25: */
26: protected $response;
27:
28: /**
29: * Set the dispatch's controller. This overrides the original route's
30: * controller.
31: *
32: * @param callable $controller
33: */
34: public function setController($controller)
35: {
36: $this->controller = $controller;
37: }
38:
39: /**
40: * Get the dispatch's controller.
41: *
42: * @return callable|null
43: */
44: public function getController()
45: {
46: return $this->controller;
47: }
48:
49: /**
50: * Set the response.
51: *
52: * @param mixed $response
53: */
54: public function setResponse($response)
55: {
56: $this->response = $response;
57: }
58:
59: /**
60: * Get the response.
61: *
62: * @return mixed
63: */
64: public function getResponse()
65: {
66: return $this->response;
67: }
68: }
69: