Revert "改名"
This reverts commit fdf58326
This commit is contained in:
@@ -1,44 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
|
|
||||||
namespace Kiri\Annotation;
|
|
||||||
|
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use Kiri;
|
|
||||||
use Kiri\Server\Tasker\AsyncTaskExecute;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class Task
|
|
||||||
* @package Annotation
|
|
||||||
* Task任务
|
|
||||||
*/
|
|
||||||
#[\Attribute(\Attribute::TARGET_CLASS)] class Task extends Attribute
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Task 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
|
|
||||||
{
|
|
||||||
$task = Kiri::getDi()->get(AsyncTaskExecute::class);
|
|
||||||
$task->reg($this->name, $class);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user