Files
kiri-core/Annotation/Model/Set.php
T
2021-08-13 15:19:07 +08:00

40 lines
629 B
PHP

<?php
namespace Annotation\Model;
use Annotation\Attribute;
use Database\ActiveRecord;
use Exception;
use Kiri\Kiri;
#[\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 = Kiri::getAnnotation();
$annotation->addSets($class, $this->name, $method);
return true;
}
}