111
This commit is contained in:
@@ -236,7 +236,7 @@ class Node
|
|||||||
*/
|
*/
|
||||||
public function addChild(Node $node): Node
|
public function addChild(Node $node): Node
|
||||||
{
|
{
|
||||||
$this->childes[] = $node;
|
$this->childes[$node->path] = $node;
|
||||||
return $node;
|
return $node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,15 +248,7 @@ class Node
|
|||||||
*/
|
*/
|
||||||
public function findNode(string $search): ?Node
|
public function findNode(string $search): ?Node
|
||||||
{
|
{
|
||||||
if (empty($this->childes)) {
|
return $this->childes[$search] ?? null;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
foreach ($this->childes as $val) {
|
|
||||||
if ($search == $val->path) {
|
|
||||||
return $val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user