From 81c5d860c62109b7a424856697585db99a16015b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 19 Apr 2021 12:43:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Annotation/Loader.php | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/Annotation/Loader.php b/Annotation/Loader.php index 73cad9fe..cf9d7dfd 100644 --- a/Annotation/Loader.php +++ b/Annotation/Loader.php @@ -151,16 +151,8 @@ class Loader extends BaseObject if (!isset($this->_directory[$directory])) { $this->_directory[$directory] = []; } - $this->_scanDir($iterator, $namespace); } else { - $array = explode('/', $path->getRealPath()); - array_pop($array); - - $directory = implode('/', $array); - - $this->_directory[$directory][] = $path->getRealPath(); - $this->readFile($path, $namespace); } } @@ -246,7 +238,6 @@ class Loader extends BaseObject if (!str_contains($key, $path)) { continue; } - var_dump($_path); $this->execute($_path); } } catch (Throwable $exception) { @@ -279,17 +270,24 @@ class Loader extends BaseObject */ public function appendFileToDirectory(string $filePath, string $className) { - $directory = $this->splitDirectory($filePath); - array_pop($directory); + $array = explode('/', $filePath); + array_pop($array); - $tree = null; - foreach ($directory as $value) { - $tree = $this->getTree($tree, $value); - } + $directory = implode('/', $array); - if ($tree instanceof FileTree) { - $tree->addFile($className, $filePath); - } + $this->_directory[$directory][] = $className; + +// $directory = $this->splitDirectory($filePath); +// array_pop($directory); +// +// $tree = null; +// foreach ($directory as $value) { +// $tree = $this->getTree($tree, $value); +// } +// +// if ($tree instanceof FileTree) { +// $tree->addFile($className, $filePath); +// } }