改名
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Annotation;
|
||||
|
||||
|
||||
use Exception;
|
||||
use Http\IInterface\Task;
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user