改名
This commit is contained in:
@@ -86,9 +86,9 @@ class Annotation extends Component
|
|||||||
*/
|
*/
|
||||||
public function runtime(string $dir, string|array $outPath = [])
|
public function runtime(string $dir, string|array $outPath = [])
|
||||||
{
|
{
|
||||||
if (!empty($outPath) && !is_array($outPath)) {
|
// if (!empty($outPath) && !is_array($outPath)) {
|
||||||
$outPath = [$outPath];
|
// $outPath = [$outPath];
|
||||||
}
|
// }
|
||||||
$this->_loader->loadByDirectory($dir, $outPath);
|
$this->_loader->loadByDirectory($dir, $outPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+31
-29
@@ -227,21 +227,23 @@ class Loader extends BaseObject
|
|||||||
* @param string|array $outPath
|
* @param string|array $outPath
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function loadByDirectory(string $path, string|array $outPath = [])
|
public function loadByDirectory(string $path, string|array $outPath = '')
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$path = '/' . trim($path, '/');
|
// $path = '/' . trim($path, '/');
|
||||||
if (!isset($this->_directory[$path])) {
|
// if (!isset($this->_directory[$path])) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
foreach ($this->_directory as $key => $_path) {
|
// foreach ($this->_directory as $key => $_path) {
|
||||||
$key = '/' . trim($path, '/');
|
// $key = '/' . trim($path, '/');
|
||||||
if (!str_starts_with($key, $path)) {
|
// if (!str_starts_with($key, $path)) {
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
// if (!empty($outPath) && in_array($key, $outPath)) continue;
|
//// if (!empty($outPath) && in_array($key, $outPath)) continue;
|
||||||
$this->execute($_path);
|
// $this->execute($_path);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
$this->each($path, $outPath);
|
||||||
} catch (Throwable $exception) {
|
} catch (Throwable $exception) {
|
||||||
$this->addError($exception, 'throwable');
|
$this->addError($exception, 'throwable');
|
||||||
}
|
}
|
||||||
@@ -272,24 +274,24 @@ class Loader extends BaseObject
|
|||||||
*/
|
*/
|
||||||
public function appendFileToDirectory(string $filePath, string $className)
|
public function appendFileToDirectory(string $filePath, string $className)
|
||||||
{
|
{
|
||||||
$array = explode('/', $filePath);
|
// $array = explode('/', $filePath);
|
||||||
array_pop($array);
|
// array_pop($array);
|
||||||
|
|
||||||
$directory = '/' . implode('/', $array);
|
|
||||||
|
|
||||||
$this->_directory[$directory][] = $className;
|
|
||||||
|
|
||||||
// $directory = $this->splitDirectory($filePath);
|
|
||||||
// array_pop($directory);
|
|
||||||
//
|
//
|
||||||
// $tree = null;
|
// $directory = '/' . implode('/', $array);
|
||||||
// foreach ($directory as $value) {
|
|
||||||
// $tree = $this->getTree($tree, $value);
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// if ($tree instanceof FileTree) {
|
// $this->_directory[$directory][] = $className;
|
||||||
// $tree->addFile($className, $filePath);
|
|
||||||
// }
|
$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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user