改名
This commit is contained in:
@@ -80,21 +80,17 @@ class Router extends HttpService implements RouterInterface
|
|||||||
*/
|
*/
|
||||||
public function addPortListen($port, Closure|array|string $closure, $method = null): Node|null|bool
|
public function addPortListen($port, Closure|array|string $closure, $method = null): Node|null|bool
|
||||||
{
|
{
|
||||||
try {
|
|
||||||
if (!is_string($closure)) {
|
if (!is_string($closure)) {
|
||||||
return $this->addRoute('add-port-listen/port_' . $port, $closure, 'listen');
|
return $this->addRoute('add-port-listen/port_' . $port, $closure, 'listen');
|
||||||
}
|
}
|
||||||
if (empty($method)) {
|
if (empty($method)) {
|
||||||
throw new NotFindClassException($closure . '::' . $method);
|
return $this->addError($closure . '::' . $method);
|
||||||
}
|
}
|
||||||
$_closure = Snowflake::createObject($closure);
|
$_closure = Snowflake::createObject($closure);
|
||||||
if (!method_exists($_closure, $method)) {
|
if (!method_exists($_closure, $method)) {
|
||||||
throw new NotFindClassException($closure . '::' . $method);
|
return $this->addError($closure . '::' . $method);
|
||||||
}
|
}
|
||||||
return $this->addRoute('add-port-listen/port_' . $port, [$_closure, $method], 'listen');
|
return $this->addRoute('add-port-listen/port_' . $port, [$_closure, $method], 'listen');
|
||||||
} catch (\Throwable $exception) {
|
|
||||||
return $this->addError($exception);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user