This commit is contained in:
2021-08-05 11:41:18 +08:00
parent d2c1d130c9
commit ae246a42d1
2 changed files with 8 additions and 3 deletions
+7 -2
View File
@@ -261,8 +261,13 @@ class Node extends HttpService
*/
public function addChild(Node $node, string $field): Node
{
$this->childes[] = $node;
return $node;
/** @var Node $oLod */
$oLod = $this->childes[$field] ?? null;
if (!empty($oLod)) {
$node = $oLod;
}
$this->childes[$field] = $node;
return $this->childes[$field];
}
+1 -1
View File
@@ -145,7 +145,7 @@ class Router extends HttpService implements RouterInterface
{
[$first, $explode] = $this->split($path);
if (!isset(static::$nodes[$method]['/'])) {
static::$nodes[$method][$first] = $this->NodeInstance('/', 0, $method);
static::$nodes[$method]['/'] = $this->NodeInstance('/', 0, $method);
}
$parent = static::$nodes[$method]['/'];