| Conditions | 3 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | public function route($view) |
||
| 8 | { |
||
| 9 | $uri = filter_input(INPUT_SERVER, 'REQUEST_URI'); |
||
| 10 | $method = ucfirst(strtolower(filter_input(INPUT_SERVER, 'REQUEST_METHOD'))); |
||
| 11 | $call = "do$method"; |
||
| 12 | $params = Config::getInstance()->getAll(); |
||
| 13 | |||
| 14 | $ex = explode('?', $uri); |
||
| 15 | $uri = $ex[0] == '/' ? 'index' : $ex[0]; |
||
| 16 | $params['title'] = $uri; |
||
| 17 | |||
| 18 | $ex = explode('/', $uri); |
||
| 19 | $ex = array_diff($ex, ['']); |
||
| 20 | while (sizeof($ex) > 0) |
||
| 21 | { |
||
| 22 | $className = '\\cvweiss\projectbase\\Controller\\' . implode('\\', $ex); |
||
| 23 | $this->routeCall($className, $call, $view, $params); |
||
| 24 | array_unshift($params, array_pop($ex)); |
||
| 25 | } |
||
| 26 | |||
| 27 | Logger::debug("404 $uri"); |
||
| 28 | $view->error(404, "$uri $method could not be found", $params); |
||
| 29 | } |
||
| 30 | |||
| 42 |