qqq
This commit is contained in:
+20
-16
@@ -42,28 +42,32 @@ class Scanner extends Component
|
||||
{
|
||||
$container = Container::instance();
|
||||
foreach ($this->files as $file) {
|
||||
$class = $this->rename($file);
|
||||
if (!class_exists($class)) {
|
||||
continue;
|
||||
}
|
||||
$reflect = $container->getReflectionClass($class);
|
||||
if ($reflect->isInstantiable()) {
|
||||
$data = $reflect->getAttributes(Skip::class);
|
||||
if (count($data) > 0) {
|
||||
try {
|
||||
$class = $this->rename($file);
|
||||
if (!class_exists($class)) {
|
||||
continue;
|
||||
}
|
||||
$object = $container->parse($class);
|
||||
|
||||
$methods = $container->getReflectionClass($class);
|
||||
foreach ($methods->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
|
||||
if ($method->isStatic() || $method->getDeclaringClass()->getName() != $class) {
|
||||
$reflect = $container->getReflectionClass($class);
|
||||
if ($reflect->isInstantiable()) {
|
||||
$data = $reflect->getAttributes(Skip::class);
|
||||
if (count($data) > 0) {
|
||||
continue;
|
||||
}
|
||||
$attributes = $method->getAttributes();
|
||||
foreach ($attributes as $attribute) {
|
||||
$attribute->newInstance()->dispatch($object, $method->getName());
|
||||
$object = $container->parse($class);
|
||||
|
||||
$methods = $container->getReflectionClass($class);
|
||||
foreach ($methods->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
|
||||
if ($method->isStatic() || $method->getDeclaringClass()->getName() != $class) {
|
||||
continue;
|
||||
}
|
||||
$attributes = $method->getAttributes();
|
||||
foreach ($attributes as $attribute) {
|
||||
$attribute->newInstance()->dispatch($object, $method->getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (\Throwable $exception) {
|
||||
error($exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user