改名
This commit is contained in:
@@ -10,6 +10,7 @@ use ReflectionClass;
|
||||
use ReflectionMethod;
|
||||
use ReflectionProperty;
|
||||
use Snowflake\Abstracts\BaseObject;
|
||||
use Snowflake\Exception\ComponentException;
|
||||
use Snowflake\Snowflake;
|
||||
use Throwable;
|
||||
|
||||
@@ -119,6 +120,7 @@ class Loader extends BaseObject
|
||||
/**
|
||||
* @param DirectoryIterator $paths
|
||||
* @param $namespace
|
||||
* @throws ComponentException
|
||||
*/
|
||||
public function _scanDir(DirectoryIterator $paths, $namespace)
|
||||
{
|
||||
@@ -199,6 +201,29 @@ class Loader extends BaseObject
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
*/
|
||||
public function loadByDirectory(string $path)
|
||||
{
|
||||
foreach ($this->_fileMap as $value) {
|
||||
if (!str_starts_with($value, $path)) {
|
||||
continue;
|
||||
}
|
||||
$annotations = $this->getClassByFilepath($path);
|
||||
|
||||
foreach ($annotations['methods'] as $name => $attribute) {
|
||||
foreach ($attribute as $value) {
|
||||
if (!($value instanceof \Annotation\Attribute)) {
|
||||
continue;
|
||||
}
|
||||
$value->execute([$annotations['handler'], $name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param DirectoryIterator $path
|
||||
* @param string $namespace
|
||||
|
||||
Reference in New Issue
Block a user