改名
This commit is contained in:
@@ -329,6 +329,7 @@ class Router extends HttpService implements RouterInterface
|
|||||||
* @return Closure|array|null
|
* @return Closure|array|null
|
||||||
* @throws NotFindClassException
|
* @throws NotFindClassException
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function getMiddlewareInstance($value): null|Closure|array
|
private function getMiddlewareInstance($value): null|Closure|array
|
||||||
{
|
{
|
||||||
@@ -387,17 +388,17 @@ class Router extends HttpService implements RouterInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array|null $explode
|
* @param string|null $explode
|
||||||
* @return Node|null
|
* @return Node|null
|
||||||
* 查找指定路由
|
* 查找指定路由
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function tree_search(?array $explode): ?Node
|
public function tree_search(?string $explode): ?Node
|
||||||
{
|
{
|
||||||
if (empty($this->nodes)) {
|
if (empty($this->nodes)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$parent = $this->nodes[array_shift($explode)] ?? null;
|
return $this->nodes[$explode] ?? null;
|
||||||
if (!($parent instanceof Node)) {
|
if (!($parent instanceof Node)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -506,7 +507,7 @@ class Router extends HttpService implements RouterInterface
|
|||||||
// }
|
// }
|
||||||
// } else {
|
// } else {
|
||||||
// }
|
// }
|
||||||
$node = $this->tree_search([$uri->getPath()]);
|
$node = $this->tree_search($uri->getPath());
|
||||||
if (!($node instanceof Node)) {
|
if (!($node instanceof Node)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user