| @@ 41-43 (lines=3) @@ | ||
| 38 | public function call() |
|
| 39 | { |
|
| 40 | ||
| 41 | if (!class_exists($this->router->route->getTarget('controller'))) { |
|
| 42 | throw new \Exception('Class not found : "' . $this->router->route->getTarget('controller') . '"'); |
|
| 43 | } |
|
| 44 | ||
| 45 | $classInstance = [ |
|
| 46 | Route::class => $this->router->route, |
|
| @@ 94-96 (lines=3) @@ | ||
| 91 | private function getController($classInstance = []) |
|
| 92 | { |
|
| 93 | $reflector = new ReflectionClass($this->router->route->getTarget('controller')); |
|
| 94 | if (!$reflector->isInstantiable()) { |
|
| 95 | throw new \Exception('Target [' . $this->router->route->getTarget('controller') . '] is not instantiable.'); |
|
| 96 | } |
|
| 97 | $constructor = $reflector->getConstructor(); |
|
| 98 | if (is_null($constructor)) { |
|
| 99 | $class = $this->router->route->getTarget('controller'); |
|
| @@ 42-44 (lines=3) @@ | ||
| 39 | */ |
|
| 40 | public function call() |
|
| 41 | { |
|
| 42 | if (!is_file($this->router->route->getTarget('template'))) { |
|
| 43 | throw new \Exception('Template file not found : "' . $this->router->route->getTarget('template') . '"'); |
|
| 44 | } |
|
| 45 | $this->setContentType($this->router->route->getTarget('extension')); |
|
| 46 | if (isset($this->router->route->getTarget('callback')[$this->router->route->getTarget('extension')])) { |
|
| 47 | $this->router->response->setContent(call_user_func_array($this->router->route->getTarget('callback')[$this->router->route->getTarget('extension')], [$this->router->route])); |
|