Files
kiri-databases/src/Annotation/Get.php
T
as2252258@163.com 667b4ecd3a 111
2021-08-29 05:53:45 +08:00

45 lines
716 B
PHP

<?php
namespace Database\Annotation;
use Attribute;
use Database\Base\Getter;
use Exception;
/**
* Class Get
* @package Annotation\Model
*/
#[Attribute(Attribute::TARGET_METHOD)] class Get extends \Annotation\Attribute
{
/**
* Get constructor.
* @param string $name
*/
public function __construct(public string $name)
{
}
/**
* @param static $params
* @param mixed $class
* @param mixed|null $method
* @return bool
* @throws \Kiri\Exception\NotFindClassException
* @throws \ReflectionException
*/
public function execute(mixed $class, mixed $method = null): bool
{
di(Getter::class)->addGetter($this->name, $class, $method);
return true;
}
}