This commit is contained in:
as2252258@163.com
2021-05-03 03:48:52 +08:00
parent a90e647529
commit 8137b24865
25 changed files with 273 additions and 306 deletions
+18 -20
View File
@@ -7,6 +7,7 @@ namespace Annotation\Model;
use Annotation\Annotation;
use Attribute;
use Database\ActiveRecord;
use Snowflake\Snowflake;
/**
@@ -17,28 +18,25 @@ use Database\ActiveRecord;
{
/**
* Get constructor.
* @param string $name
*/
public function __construct(
public string $name
)
{
}
/**
* Get constructor.
* @param string $name
*/
public function __construct(public string $name)
{
}
/**
* @param array $handler
* @return ActiveRecord
*/
public function execute(array $handler): ActiveRecord
{
/** @var ActiveRecord $activeRecord */
[$activeRecord, $method] = $handler;
return $activeRecord->addGets($this->name, $method);
}
/**
* @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;
}
}