变更
This commit is contained in:
@@ -7,4 +7,20 @@ namespace Kiri\Router\Inject;
|
|||||||
#[\Attribute(\Attribute::TARGET_CLASS)]
|
#[\Attribute(\Attribute::TARGET_CLASS)]
|
||||||
class Controller
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user