Files
kiri-core/Annotation/Model/Set.php
T
2021-07-12 17:17:36 +08:00

40 lines
651 B
PHP

<?php
namespace Annotation\Model;
use Annotation\Attribute;
use Database\ActiveRecord;
use Exception;
use Snowflake\Snowflake;
#[\Attribute(\Attribute::TARGET_METHOD)] class Set extends Attribute
{
/**
* Set 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->addSets($class::class, $this->name, $method);
return true;
}
}