This commit is contained in:
2021-09-18 11:23:10 +08:00
parent 1e2770a94a
commit b059bb2d1a
+6 -6
View File
@@ -56,14 +56,14 @@ abstract class Handler implements RequestHandlerInterface
protected function dispatcher(): mixed protected function dispatcher(): mixed
{ {
if ($this->handler->callback instanceof \Closure) { if ($this->handler->callback instanceof \Closure) {
return call_user_func($this->handler->callback, ...$this->handler->params); $response = call_user_func($this->handler->callback, ...$this->handler->params);
} else {
[$controller, $action] = $this->handler->callback;
$controller = Kiri::getDi()->get($controller);
$response = call_user_func([$controller, $action], ...$this->handler->params);
} }
[$controller, $action] = $this->handler->callback;
$controller = Kiri::getDi()->get($controller);
$response = call_user_func([$controller, $action], ...$this->handler->params);
if (!($response instanceof ResponseInterface)) { if (!($response instanceof ResponseInterface)) {
$response = $this->transferToResponse($response); $response = $this->transferToResponse($response);
} }