改名
This commit is contained in:
@@ -69,9 +69,7 @@ class Node extends HttpService
|
|||||||
*/
|
*/
|
||||||
public function bindHandler($handler): static
|
public function bindHandler($handler): static
|
||||||
{
|
{
|
||||||
if ($handler instanceof Closure) {
|
if (is_string($handler) && str_contains($handler, '@')) {
|
||||||
$this->handler = $handler;
|
|
||||||
} else if (is_string($handler) && str_contains($handler, '@')) {
|
|
||||||
list($controller, $action) = explode('@', $handler);
|
list($controller, $action) = explode('@', $handler);
|
||||||
if (!empty($this->namespace)) {
|
if (!empty($this->namespace)) {
|
||||||
$controller = implode('\\', $this->namespace) . '\\' . $controller;
|
$controller = implode('\\', $this->namespace) . '\\' . $controller;
|
||||||
@@ -79,13 +77,15 @@ class Node extends HttpService
|
|||||||
$this->handler = $this->getReflect($controller, $action);
|
$this->handler = $this->getReflect($controller, $action);
|
||||||
} else if ($handler != null && !is_callable($handler, true)) {
|
} else if ($handler != null && !is_callable($handler, true)) {
|
||||||
$this->_error = 'Controller is con\'t exec.';
|
$this->_error = 'Controller is con\'t exec.';
|
||||||
|
} else if ($handler instanceof Closure) {
|
||||||
|
$this->handler = $handler;
|
||||||
} else {
|
} else {
|
||||||
[$controller, $action] = $this->handler = $handler;
|
[$controller, $action] = $this->handler = $handler;
|
||||||
if ($controller instanceof Controller) {
|
if (!($controller instanceof Controller)) {
|
||||||
$this->annotationInject(get_class($controller), $action);
|
return $this;
|
||||||
|
|
||||||
$this->callback = Reduce::reduce($this->createDispatch(), $this->annotation());
|
|
||||||
}
|
}
|
||||||
|
$this->annotationInject(get_class($controller), $action);
|
||||||
|
$this->callback = Reduce::reduce($this->createDispatch(), $this->annotation());
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user