Files
kiri-databases/Annotation/Set.php
T

40 lines
671 B
PHP
Raw Normal View History

2021-08-17 16:22:18 +08:00
<?php
2022-01-08 18:49:06 +08:00
namespace Database\Annotation;
2021-08-17 16:22:18 +08:00
2022-01-08 18:49:06 +08:00
use Kiri\Annotation\Attribute;
2021-08-17 16:22:18 +08:00
use Database\Base\Setter;
use Exception;
#[\Attribute(\Attribute::TARGET_METHOD)] class Set extends Attribute
{
/**
* Set constructor.
* @param string $name
*/
2021-08-29 05:53:45 +08:00
public function __construct(public string $name)
2021-08-17 16:22:18 +08:00
{
}
/**
2021-08-29 04:06:48 +08:00
* @param static $params
2021-08-17 16:22:18 +08:00
* @param mixed $class
* @param mixed|null $method
* @return bool
2021-08-29 04:06:48 +08:00
* @throws \Kiri\Exception\NotFindClassException
* @throws \ReflectionException
2021-08-17 16:22:18 +08:00
*/
2021-08-29 05:53:45 +08:00
public function execute(mixed $class, mixed $method = null): bool
2021-08-17 16:22:18 +08:00
{
2021-08-29 05:53:45 +08:00
di(Setter::class)->addSetter($this->name, $class, $method);
2021-08-17 16:22:18 +08:00
return true;
}
}