This commit is contained in:
as2252258@163.com
2021-04-08 01:15:02 +08:00
parent a166ed44b7
commit 4e5fa54666
+21 -11
View File
@@ -279,13 +279,11 @@ class Loader extends BaseObject
if (empty($value)) { if (empty($value)) {
continue; continue;
} }
if ($tree === null) { $tree = $this->getTree($tree, $value);
$tree = $this->files->getChild($value); }
} else { if ($tree instanceof FileTree) {
$tree = $tree->getChild($value); $tree->addFile($className);
}
} }
$tree->addFile($className);
} }
@@ -302,11 +300,7 @@ class Loader extends BaseObject
if (empty($value)) { if (empty($value)) {
continue; continue;
} }
if ($tree === null) { $tree = $this->getTree($tree, $value);
$tree = $this->files->getChild($value);
} else {
$tree = $tree->getChild($value);
}
} }
if ($tree instanceof FileTree) { if ($tree instanceof FileTree) {
$this->eachNode($tree->getChildes()); $this->eachNode($tree->getChildes());
@@ -316,6 +310,22 @@ class Loader extends BaseObject
} }
/**
* @param $tree
* @param $value
* @return FileTree
*/
private function getTree($tree, $value): FileTree
{
if ($tree === null) {
$tree = $this->files->getChild($value);
} else {
$tree = $tree->getChild($value);
}
return $tree;
}
/** /**
* @param FileTree[] $nodes * @param FileTree[] $nodes
*/ */