1 | <?php |
||
13 | class Cfar |
||
14 | { |
||
15 | |||
16 | /** |
||
17 | * This is here to bail the current request if a "listener" was not defined on the class. |
||
18 | * @var string |
||
19 | */ |
||
20 | const CFAR_DEFAULT_METHOD = 'indexAction'; |
||
21 | |||
22 | /** |
||
23 | * Aura.Router Instance |
||
24 | * @var Route |
||
25 | */ |
||
26 | protected $matchedRoute; |
||
27 | |||
28 | /** |
||
29 | * The name of the called controller class (plus it's fully quantified namespace). |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $controller; |
||
33 | |||
34 | /** |
||
35 | * The name of the method invoked on the called class . |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $method; |
||
39 | |||
40 | /** |
||
41 | * The parameters to be passed unto the method. |
||
42 | * @var array |
||
43 | */ |
||
44 | protected $parameters; |
||
45 | |||
46 | /** |
||
47 | * @param Route $router |
||
48 | */ |
||
49 | 3 | public function __construct(Route $router) |
|
53 | |||
54 | /** |
||
55 | * Returns an array of parameters for the matched route. |
||
56 | * @return array |
||
57 | */ |
||
58 | 1 | public function getParameters() |
|
62 | |||
63 | /** |
||
64 | * Returns a string that denotes the called class plus it's namespace |
||
65 | * @return string |
||
66 | */ |
||
67 | 1 | public function getController() |
|
71 | |||
72 | /** |
||
73 | * Returns a string that denotes the method that was invoked. |
||
74 | * @return string |
||
75 | */ |
||
76 | 2 | public function getMethod() |
|
80 | |||
81 | /** |
||
82 | * Calls the controller associated with the route and invoke the specified method. |
||
83 | * @throws \Adelowo\Cfar\CfarException if the class cannot be be found |
||
84 | */ |
||
85 | 3 | public function dispatch() |
|
103 | |||
104 | /** |
||
105 | * @return array |
||
106 | */ |
||
107 | 2 | protected function getRegisteredControllerAndMethod() |
|
115 | |||
116 | /** |
||
117 | * @return \ReflectionClass |
||
118 | */ |
||
119 | 3 | protected function doesRouteHaveAValidDeclaration() |
|
123 | |||
124 | |||
125 | /** |
||
126 | * @param $class string|object The class to resolve |
||
127 | * @return \ReflectionClass |
||
128 | */ |
||
129 | 3 | protected function getReflectionClass($class) |
|
133 | } |
||
134 |