This commit is contained in:
as2252258@163.com
2021-09-12 03:53:54 +08:00
parent dd71782fcd
commit bb077b5467
+2 -10
View File
@@ -236,7 +236,7 @@ class Node
*/
public function addChild(Node $node): Node
{
$this->childes[] = $node;
$this->childes[$node->path] = $node;
return $node;
}
@@ -248,15 +248,7 @@ class Node
*/
public function findNode(string $search): ?Node
{
if (empty($this->childes)) {
return null;
}
foreach ($this->childes as $val) {
if ($search == $val->path) {
return $val;
}
}
return null;
return $this->childes[$search] ?? null;
}