This commit is contained in:
xl
2023-11-17 00:02:41 +08:00
parent ef3fb24ba4
commit 73a71267f5
+2 -4
View File
@@ -175,15 +175,13 @@ class RouterCollector implements \ArrayAccess, \IteratorAggregate
private function resolve(string|array $closure, ControllerInterpreter $interpreter): Handler private function resolve(string|array $closure, ControllerInterpreter $interpreter): Handler
{ {
if (is_array($closure)) { if (is_array($closure)) {
[$class, $method] = $closure; return $interpreter->addRouteByString(... $closure);
} else { }
if (!str_contains($closure, '@')) { if (!str_contains($closure, '@')) {
$closure .= '@'; $closure .= '@';
} }
[$className, $method] = explode('@', $closure); [$className, $method] = explode('@', $closure);
$class = $this->container->get($this->resetName($className)); $class = $this->container->get($this->resetName($className));
}
return $interpreter->addRouteByString($class, $method); return $interpreter->addRouteByString($class, $method);
} }