This commit is contained in:
2021-08-25 11:25:02 +08:00
parent 83cf04b31b
commit 86863ec30e
+3 -2
View File
@@ -445,7 +445,6 @@ class Router extends HttpService implements RouterInterface
foreach ($this->nodes as $node) {
/** @var Node[] $node */
foreach ($node as $_node) {
$path[] = ['method' => $_node->method, 'path' => $_node->sourcePath];
$paths = $this->getChildes($_node, $paths);
}
}
@@ -461,7 +460,9 @@ class Router extends HttpService implements RouterInterface
private function getChildes(Node $node, array $path): array
{
foreach ($node->childes as $item) {
$path[] = ['method' => $item->method, 'path' => $item->sourcePath];
if (!empty($_node->sourcePath)) {
$path[] = ['method' => $item->method, 'path' => $item->sourcePath];
}
if (!empty($item->childes)) {
$path = $this->getChildes($item, $path);
}