1 | <?php |
||
13 | class RouteHandler |
||
14 | { |
||
15 | /** |
||
16 | * @var ContainerInterface $di the dependency/service container. |
||
17 | */ |
||
18 | protected $di; |
||
19 | |||
20 | |||
21 | |||
22 | /** |
||
23 | * Handle the action for a route and return the results. |
||
24 | * |
||
25 | * @param string $method the request method. |
||
26 | * @param string $path that was matched. |
||
27 | * @param string|array $action base for the callable. |
||
28 | * @param array $arguments optional arguments. |
||
29 | * @param ContainerInjectableInterface $di container with services. |
||
30 | * |
||
31 | * @return mixed as the result from the route handler. |
||
32 | */ |
||
33 | public function handle( |
||
69 | |||
70 | |||
71 | |||
72 | /** |
||
73 | * Check if items can be used to call a controller action, verify |
||
74 | * that the controller exists, the action has a class-method to call. |
||
75 | * |
||
76 | * @param string $method the request method. |
||
77 | * @param string $path the matched path, base for the controller action |
||
78 | * and the arguments. |
||
79 | * @param string $class the controller class |
||
80 | * |
||
81 | * @return array with callable details. |
||
82 | */ |
||
83 | protected function isControllerAction( |
||
111 | |||
112 | |||
113 | |||
114 | /** |
||
115 | * Call the controller action with optional arguments and call |
||
116 | * initialisation methods if available. |
||
117 | * |
||
118 | * @param string $callable with details on what controller action to call. |
||
119 | * |
||
120 | * @return mixed result from the handler. |
||
121 | */ |
||
122 | protected function handleAsControllerAction(array $callable) |
||
153 | |||
154 | |||
155 | |||
156 | /** |
||
157 | * Handle as callable support callables where the method is not static. |
||
158 | * |
||
159 | * @param string|array $action base for the callable |
||
160 | * @param array $arguments optional arguments |
||
161 | * @param ContainerInjectableInterface $di container with services |
||
162 | * |
||
163 | * @return mixed as the result from the route handler. |
||
164 | */ |
||
165 | protected function handleAsCallable( |
||
195 | |||
196 | |||
197 | |||
198 | /** |
||
199 | * Load callable as a service from the $di container. |
||
200 | * |
||
201 | * @param string|array $action base for the callable |
||
202 | * @param array $arguments optional arguments |
||
203 | * @param ContainerInjectableInterface $di container with services |
||
204 | * |
||
205 | * @return mixed as the result from the route handler. |
||
206 | */ |
||
207 | protected function handleUsingDi( |
||
228 | } |
||
229 |