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

40 lines
629 B
PHP
Raw Normal View History

2021-03-03 18:35:04 +08:00
<?php
namespace Annotation\Model;
use Annotation\Attribute;
use Database\ActiveRecord;
2021-07-12 17:17:36 +08:00
use Exception;
2021-08-11 01:04:57 +08:00
use Kiri\Kiri;
2021-03-03 18:35:04 +08:00
#[\Attribute(\Attribute::TARGET_METHOD)] class Set extends Attribute
{
/**
* Set constructor.
* @param string $name
*/
public function __construct(public string $name)
{
}
2021-05-03 03:48:52 +08:00
/**
* @param mixed $class
* @param mixed|null $method
* @return bool
2021-07-12 17:17:36 +08:00
* @throws Exception
2021-05-03 03:48:52 +08:00
*/
public function execute(mixed $class, mixed $method = null): bool
2021-03-03 18:35:04 +08:00
{
2021-08-11 01:04:57 +08:00
$annotation = Kiri::getAnnotation();
2021-08-13 15:19:07 +08:00
$annotation->addSets($class, $this->name, $method);
2021-05-03 03:48:52 +08:00
return true;
2021-03-03 18:35:04 +08:00
}
}