Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
71 | public function execute(string $namespace): void |
||
72 | { |
||
73 | $controller = $namespace . "\\" . $this->controller; |
||
74 | |||
75 | if (!class_exists($controller)) { |
||
76 | throw new ErrorRoute("Controller {$controller} not found", 404); |
||
77 | } |
||
78 | |||
79 | if (!method_exists($controller, $this->method)) { |
||
80 | throw new ErrorRoute("Method {$this->method} not found in {$controller}", 405); |
||
81 | } |
||
82 | |||
83 | call_user_func([new $controller(), $this->method], $this->param); |
||
84 | } |
||
86 |