This commit is contained in:
as2252258@163.com
2021-08-31 01:58:05 +08:00
parent 742867e2f9
commit a0bf0d3e66
+2 -6
View File
@@ -430,9 +430,7 @@ class Router extends HttpService implements RouterInterface
$paths = [];
foreach ($this->nodes as $_node) {
/** @var Node[] $node */
if (!empty($_node->sourcePath)) {
$path[] = ['method' => $_node->method, 'path' => $_node->sourcePath];
}
$paths[] = ['method' => $_node->method, 'path' => $_node->sourcePath];
$paths = $this->getChildes($_node, $paths);
}
return $paths;
@@ -447,9 +445,7 @@ class Router extends HttpService implements RouterInterface
private function getChildes(Node $node, array $path): array
{
foreach ($node->childes as $item) {
if (!empty($item->sourcePath)) {
$path[] = ['method' => $item->method, 'path' => $item->sourcePath];
}
$path[] = ['method' => $item->method, 'path' => $item->sourcePath];
if (!empty($item->childes)) {
$path = $this->getChildes($item, $path);
}