2021-01-19 17:45:33 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Annotation\Model;
|
|
|
|
|
|
|
|
|
|
|
2021-02-22 17:44:24 +08:00
|
|
|
use Annotation\Annotation;
|
2021-01-19 17:45:33 +08:00
|
|
|
use Attribute;
|
2021-01-20 15:45:53 +08:00
|
|
|
use Database\ActiveRecord;
|
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)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param array $handler
|
|
|
|
|
* @return ActiveRecord
|
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
}
|