diff --git a/src/Inject/Controller.php b/src/Inject/Controller.php index add2c4b..dd80381 100644 --- a/src/Inject/Controller.php +++ b/src/Inject/Controller.php @@ -7,4 +7,20 @@ namespace Kiri\Router\Inject; #[\Attribute(\Attribute::TARGET_CLASS)] class Controller { + + /** + * @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()); + } + } + + } + }