This commit is contained in:
2023-04-16 20:36:47 +08:00
parent 8ea9cb20ab
commit 027efbe75e
15 changed files with 22 additions and 22 deletions
+26
View File
@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace Kiri\Router\Annotate;
#[\Attribute(\Attribute::TARGET_CLASS)]
class AutoController
{
/**
* @throws \ReflectionException
*/
public function dispatch(object $object): void
{
$reflection = \Kiri::getDi()->getReflectionClass($object::class);
foreach ($reflection->getMethods() as $method) {
$attributes = $method->getAttributes();
foreach ($attributes as $attribute) {
$attribute->newInstance()->dispatch($object, $method->getName());
}
}
}
}