Files
kiri-core/Annotation/Model/Get.php
T

44 lines
689 B
PHP
Raw Normal View History

2021-01-19 17:45:33 +08:00
<?php
namespace Annotation\Model;
use Attribute;
2021-07-12 17:17:36 +08:00
use Exception;
2021-05-03 03:48:52 +08:00
use Snowflake\Snowflake;
2021-01-19 17:45:33 +08:00
/**
* Class Get
* @package Annotation\Model
*/
2021-03-03 18:35:04 +08:00
#[Attribute(Attribute::TARGET_METHOD)] class Get extends \Annotation\Attribute
2021-01-19 17:45:33 +08:00
{
2021-05-03 03:48:52 +08:00
/**
* Get constructor.
* @param string $name
*/
public function __construct(public string $name)
{
}
2021-07-12 17:17:36 +08:00
/**
* @param mixed $class
* @param mixed|null $method
* @return bool
* @throws Exception
*/
2021-05-03 03:48:52 +08:00
public function execute(mixed $class, mixed $method = null): bool
{
$annotation = Snowflake::getAnnotation();
$annotation->addGets($class::class, $this->name, $method);
return true;
}
2021-02-22 17:44:24 +08:00
2021-01-19 17:45:33 +08:00
}