This commit is contained in:
2021-09-24 17:22:02 +08:00
parent 0aafbb03e2
commit dbc30827f8
86 changed files with 5 additions and 4 deletions
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace Annotation;
use Exception;
use Kiri\Kiri;
/**
* Class Asynchronous
* @package Annotation
* Task任务
*/
#[\Attribute(\Attribute::TARGET_CLASS)] class Asynchronous extends Attribute
{
/**
* Asynchronous 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
{
$async = Kiri::app()->getAsync();
$async->addAsync($this->name, $class);
return true;
}
}