111
This commit is contained in:
@@ -156,15 +156,13 @@ class Router extends HttpService implements RouterInterface
|
|||||||
private function getRootNode($root, $method, bool $create = true): array
|
private function getRootNode($root, $method, bool $create = true): array
|
||||||
{
|
{
|
||||||
[$start, $explode] = $this->path_recombination($root);
|
[$start, $explode] = $this->path_recombination($root);
|
||||||
|
$parent = $this->nodes[$start] ?? null;
|
||||||
foreach ($this->nodes as $node) {
|
if ($parent instanceof Node) {
|
||||||
if ($node->path == $start) {
|
return [$parent, $explode];
|
||||||
return [$node, $explode];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ($create) {
|
if ($create) {
|
||||||
$parent = $this->NodeInstance($root, 0, $method);
|
$parent = $this->NodeInstance($root, 0, $method);
|
||||||
$this->nodes[] = $parent;
|
$this->nodes[$start] = $parent;
|
||||||
|
|
||||||
return [$parent, $explode];
|
return [$parent, $explode];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user