1 | <?php |
||
14 | class Cfar |
||
15 | { |
||
16 | |||
17 | /** |
||
18 | * This is here to bail the current request if a "listener" was not defined on the class. |
||
19 | * @var string |
||
20 | */ |
||
21 | const CFAR_DEFAULT_METHOD = 'indexAction'; |
||
22 | |||
23 | /** |
||
24 | * "\SomeClass@method" |
||
25 | * @var string |
||
26 | */ |
||
27 | const SEPARATOR = "@"; |
||
28 | |||
29 | /** |
||
30 | * Aura.Router Instance |
||
31 | * @var Route |
||
32 | */ |
||
33 | protected $matchedRoute; |
||
34 | |||
35 | /** |
||
36 | * The name of the called controller class (plus it's fully quantified namespace). |
||
37 | * @var string |
||
38 | */ |
||
39 | protected $controller; |
||
40 | |||
41 | /** |
||
42 | * The name of the method invoked on the called class . |
||
43 | * @var string |
||
44 | */ |
||
45 | protected $method; |
||
46 | |||
47 | /** |
||
48 | * The parameters to be passed unto the method. |
||
49 | * @var array |
||
50 | */ |
||
51 | protected $parameters; |
||
52 | |||
53 | /** |
||
54 | * Bring your own container to the party |
||
55 | * @var \Interop\Container\ContainerInterface|null |
||
56 | */ |
||
57 | protected $container; |
||
58 | |||
59 | /** |
||
60 | * @param \Aura\Router\Route $router |
||
61 | * @param \Interop\Container\ContainerInterface|null $container |
||
62 | */ |
||
63 | 3 | public function __construct(Route $router, ContainerInterface $container = null) |
|
68 | |||
69 | /** |
||
70 | * Returns an array of parameters for the matched route. |
||
71 | * @return array |
||
72 | */ |
||
73 | 1 | public function getParameters() |
|
77 | |||
78 | /** |
||
79 | * Returns a string that denotes the called class plus it's namespace |
||
80 | * @return string |
||
81 | */ |
||
82 | 1 | public function getController() |
|
86 | |||
87 | /** |
||
88 | * Returns a string that denotes the method that was invoked. |
||
89 | * @return string |
||
90 | */ |
||
91 | 3 | public function getMethod() |
|
95 | |||
96 | /** |
||
97 | * Calls the controller associated with the route and invoke the specified method. |
||
98 | * @throws \Adelowo\Cfar\CfarException if the class cannot be be found |
||
99 | */ |
||
100 | 3 | public function dispatch() |
|
120 | |||
121 | /** |
||
122 | * @return array |
||
123 | */ |
||
124 | 3 | protected function getRegisteredControllerAndMethod() |
|
137 | |||
138 | /** |
||
139 | * @param $class string|object The class to resolve |
||
140 | * @return \ReflectionClass |
||
141 | */ |
||
142 | 3 | protected function getReflectionClass($class) |
|
146 | } |
||
147 |