diff --git a/Annotation/Annotation.php b/Annotation/Annotation.php index 30fd05af..3d175763 100644 --- a/Annotation/Annotation.php +++ b/Annotation/Annotation.php @@ -203,13 +203,4 @@ class Annotation extends Component } - /** - * @param string $filename - * @return mixed - */ - public function getFilename(string $filename): mixed - { - return $this->_loader->getClassByFilepath($filename); - } - } diff --git a/Annotation/Loader.php b/Annotation/Loader.php index 33acc451..ad809d38 100644 --- a/Annotation/Loader.php +++ b/Annotation/Loader.php @@ -27,9 +27,6 @@ class Loader extends BaseObject private array $_classes = []; - private array $_fileMap = []; - - private array $_directory = []; @@ -178,8 +175,6 @@ class Loader extends BaseObject $_array = $this->_methods($replace, $_array); $_array = $this->_properties($replace, $_array); - $this->_fileMap[$replace->getFileName()] = $replace->getName(); - $this->_classes[$replace->getName()] = $_array; } catch (Throwable $throwable) { $this->addError($throwable, 'throwable'); @@ -320,19 +315,6 @@ class Loader extends BaseObject } - /** - * @param string $filename - * @return mixed - */ - public function getClassByFilepath(string $filename): mixed - { - if (!isset($this->_fileMap[$filename])) { - return null; - } - return $this->_classes[$this->_fileMap[$filename]]; - } - - /** * @param array $classes */ diff --git a/function.php b/function.php index 7bebd110..c50a7f08 100644 --- a/function.php +++ b/function.php @@ -115,56 +115,6 @@ if (!function_exists('swoole')) { } -if (!function_exists('recursive_directory')) { - - - /** - * @param DirectoryIterator $file - * @throws Exception - */ - function recursive_callback(DirectoryIterator $file) - { - $attributes = Snowflake::getAnnotation(); - - $annotations = $attributes->getFilename($file->getRealPath()); - if (empty($annotations)) { - return; - } - - /** @var Attribute $value */ - foreach ($annotations['methods'] as $name => $attribute) { - foreach ($attribute as $value) { - if (!($value instanceof Attribute)) { - continue; - } - $value->execute([$annotations['handler'], $name]); - } - } - } - - /** - * @param string $path - */ - function recursive_directory(string $path) - { - $directoryIterators = new \DirectoryIterator($path); - foreach ($directoryIterators as $directoryIterator) { - if ($directoryIterator->getFilename() === '.' || $directoryIterator->getFilename() === '..') { - continue; - } - if ($directoryIterator->isDir()) { - Recursive_directory($directoryIterator->getRealPath()); - } else { - call_user_func('recursive_callback', $directoryIterator); - } - } - unset($directoryIterators); - } - - -} - - if (!function_exists('directory')) { /**