This commit is contained in:
2021-04-20 10:33:06 +08:00
parent c1aa83e313
commit 081ffb7899
+21 -21
View File
@@ -230,17 +230,17 @@ class Loader extends BaseObject
public function loadByDirectory(string $path, string|array $outPath = '') public function loadByDirectory(string $path, string|array $outPath = '')
{ {
try { try {
$path = '/' . trim($path, '/'); // $path = '/' . trim($path, '/');
foreach ($this->_directory as $key => $_path) { // foreach ($this->_directory as $key => $_path) {
$key = '/' . trim($key, '/'); // $key = '/' . trim($key, '/');
if (!str_starts_with($key, $path)) { // if (!str_starts_with($key, $path)) {
continue; // continue;
} // }
if (in_array($key, $outPath)) continue; // if (in_array($key, $outPath)) continue;
$this->execute($_path); // $this->execute($_path);
} // }
// $this->each($path, $outPath); $this->each($path, $outPath);
} catch (Throwable $exception) { } catch (Throwable $exception) {
$this->addError($exception, 'throwable'); $this->addError($exception, 'throwable');
} }
@@ -278,17 +278,17 @@ class Loader extends BaseObject
$this->_directory[$array][] = $className; $this->_directory[$array][] = $className;
// $directory = $this->splitDirectory($filePath); $directory = $this->splitDirectory($filePath);
// array_pop($directory); array_pop($directory);
//
// $tree = null; $tree = null;
// foreach ($directory as $value) { foreach ($directory as $value) {
// $tree = $this->getTree($tree, $value); $tree = $this->getTree($tree, $value);
// } }
//
// if ($tree instanceof FileTree) { if ($tree instanceof FileTree) {
// $tree->addFile($className, $filePath); $tree->addFile($className, $filePath);
// } }
} }