d8222366b1
This reverts commit fdf58326
34 lines
628 B
PHP
34 lines
628 B
PHP
<?php
|
|
|
|
namespace Kiri\Task\Annotation;
|
|
|
|
|
|
use Kiri\Annotation\Attribute;
|
|
use Kiri\Task\TaskManager;
|
|
|
|
#[\Attribute(\Attribute::TARGET_CLASS)] class AsynchronousTask extends Attribute
|
|
{
|
|
|
|
|
|
/**
|
|
* @param string $name
|
|
*/
|
|
public function __construct(public string $name)
|
|
{
|
|
}
|
|
|
|
|
|
/**
|
|
* @param mixed $class
|
|
* @param mixed $method
|
|
* @return mixed
|
|
*/
|
|
public function execute(mixed $class, mixed $method = ''): mixed
|
|
{
|
|
$AsyncTaskExecute = \Kiri::getDi()->get(TaskManager::class);
|
|
$AsyncTaskExecute->add($this->name, $class::class);
|
|
return parent::execute($class, $method); // TODO: Change the autogenerated stub
|
|
}
|
|
|
|
}
|