改名
This commit is contained in:
@@ -35,7 +35,10 @@ use Kiri\Events\EventProvider;
|
|||||||
public function execute(mixed $class, mixed $method = null): bool
|
public function execute(mixed $class, mixed $method = null): bool
|
||||||
{
|
{
|
||||||
$pro = di(EventProvider::class);
|
$pro = di(EventProvider::class);
|
||||||
$pro->on($this->name, [di($class), $method]);
|
if (is_string($class)) {
|
||||||
|
$class = di($class);
|
||||||
|
}
|
||||||
|
$pro->on($this->name, [$class, $method]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -554,14 +554,13 @@ class Router extends HttpService implements RouterInterface
|
|||||||
|
|
||||||
$di = Kiri::getDi();
|
$di = Kiri::getDi();
|
||||||
foreach ($classes as $class) {
|
foreach ($classes as $class) {
|
||||||
$instance = $di->get($class);
|
|
||||||
$methods = $di->getMethodAttribute($class);
|
$methods = $di->getMethodAttribute($class);
|
||||||
foreach ($methods as $method => $attribute) {
|
foreach ($methods as $method => $attribute) {
|
||||||
if (empty($attribute)) {
|
if (empty($attribute)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
foreach ($attribute as $item) {
|
foreach ($attribute as $item) {
|
||||||
$item->execute($instance, $method);
|
$item->execute($class, $method);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ class OnServerWorker extends \Server\Abstracts\Server
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Annotation $annotation
|
* @param Annotation $annotation
|
||||||
* @throws NotFindClassException
|
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
|||||||
+2
-3
@@ -123,9 +123,8 @@ if (!function_exists('injectRuntime')) {
|
|||||||
$fileLists = Kiri::getAnnotation()->runtime($path, $exclude);
|
$fileLists = Kiri::getAnnotation()->runtime($path, $exclude);
|
||||||
$di = Kiri::getDi();
|
$di = Kiri::getDi();
|
||||||
foreach ($fileLists as $class) {
|
foreach ($fileLists as $class) {
|
||||||
$instance = $di->get($class);
|
|
||||||
foreach ($di->getTargetNote($class) as $value) {
|
foreach ($di->getTargetNote($class) as $value) {
|
||||||
$value->execute($instance);
|
$value->execute($class);
|
||||||
}
|
}
|
||||||
$methods = $di->getMethodAttribute($class);
|
$methods = $di->getMethodAttribute($class);
|
||||||
foreach ($methods as $method => $attribute) {
|
foreach ($methods as $method => $attribute) {
|
||||||
@@ -133,7 +132,7 @@ if (!function_exists('injectRuntime')) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
foreach ($attribute as $item) {
|
foreach ($attribute as $item) {
|
||||||
$item->execute($instance, $method);
|
$item->execute($class, $method);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user