1 | <?php |
||
20 | trait Router { |
||
21 | use |
||
22 | CLI, |
||
23 | Controller, |
||
24 | Files; |
||
25 | /** |
||
26 | * Path that will be used by controller to render page |
||
27 | * |
||
28 | * @var string[] |
||
29 | */ |
||
30 | protected $controller_path; |
||
31 | /** |
||
32 | * Execute router |
||
33 | * |
||
34 | * Depending on module, files-based or controller-based router might be used |
||
35 | * |
||
36 | * @throws ExitException |
||
37 | */ |
||
38 | protected function execute_router () { |
||
47 | /** |
||
48 | * Normalize `cs\Request::$route_path` and fill `cs\App::$controller_path` |
||
49 | * |
||
50 | * @param Request $Request |
||
51 | * |
||
52 | * @throws ExitException |
||
53 | */ |
||
54 | protected function check_and_normalize_route ($Request) { |
||
82 | /** |
||
83 | * @param string $path |
||
84 | * @param array $structure |
||
85 | * @param bool $cli_or_api_path |
||
86 | * |
||
87 | * @throws ExitException |
||
88 | */ |
||
89 | protected function check_and_normalize_route_internal (&$path, $structure, $cli_or_api_path) { |
||
109 | /** |
||
110 | * If HTTP method handler not found we generate either `501 Not Implemented` if other methods are supported or `404 Not Found` if handlers for others |
||
111 | * methods also doesn't exist |
||
112 | * |
||
113 | * @param string[] $available_methods |
||
114 | * @param string $request_method |
||
115 | * @param Request $Request |
||
116 | * |
||
117 | * @throws ExitException |
||
118 | */ |
||
119 | protected function handler_not_found ($available_methods, $request_method, $Request) { |
||
136 | } |
||
137 |