Files
kiri-core/Annotation/Model/Get.php
T
as2252258@163.com 4e3b41331d modify
2021-07-27 03:30:55 +08:00

44 lines
689 B
PHP

<?php
namespace Annotation\Model;
use Attribute;
use Exception;
use Snowflake\Snowflake;
/**
* 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 mixed $class
* @param mixed|null $method
* @return bool
* @throws Exception
*/
public function execute(mixed $class, mixed $method = null): bool
{
$annotation = Snowflake::getAnnotation();
$annotation->addGets($class::class, $this->name, $method);
return true;
}
}