@@ 44-52 (lines=9) @@ | ||
41 | ||
42 | $params = empty($this->router->route->getParameters()) ? $classInstance : array_merge($this->router->route->getParameters(), $classInstance); |
|
43 | $content = call_user_func_array($this->router->route->getTarget('closure'), $params); |
|
44 | if ($content instanceof ResponseInterface) { |
|
45 | $this->router->response = $content; |
|
46 | } else { |
|
47 | if (is_array($content)) { |
|
48 | $this->router->route->addTarget('data', $content); |
|
49 | $content = json_encode($content); |
|
50 | } |
|
51 | $this->router->response->setContent($content); |
|
52 | } |
|
53 | } |
|
54 | ||
55 | } |
@@ 64-72 (lines=9) @@ | ||
61 | if ($count == count($this->router->route->getParameters()) || ($this->router->route->getParameters() == '' && $count == 0)) { |
|
62 | $dependencies = array_merge($dependencies, ($this->router->route->getParameters() == '') ? [] : $this->router->route->getParameters()); |
|
63 | $content = $reflectionMethod->invokeArgs($this->getController($classInstance), $dependencies); |
|
64 | if ($content instanceof ResponseInterface) { |
|
65 | $this->router->response = $content; |
|
66 | } else { |
|
67 | if (is_array($content)) { |
|
68 | $this->router->route->addTarget('data', $content); |
|
69 | $content = json_encode($content); |
|
70 | } |
|
71 | $this->router->response->setContent($content); |
|
72 | } |
|
73 | } else { |
|
74 | $this->router->response->setStatusCode(404); |
|
75 | } |