2022-01-17 18:45:00 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Kiri\Task\Annotation;
|
|
|
|
|
|
|
|
|
|
|
2022-02-23 16:32:08 +08:00
|
|
|
use Kiri\Annotation\AbstractAttribute;
|
2022-06-16 17:38:23 +08:00
|
|
|
use Kiri\Task\TaskContainer;
|
2022-01-17 18:45:00 +08:00
|
|
|
|
2022-02-23 16:32:08 +08:00
|
|
|
#[\Attribute(\Attribute::TARGET_CLASS)] class AsynchronousTask extends AbstractAttribute
|
2022-01-17 18:45:00 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @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
|
|
|
|
|
{
|
2022-06-16 17:38:23 +08:00
|
|
|
// TODO: Change the autogenerated stub
|
|
|
|
|
di(TaskContainer::class)->add($this->name, $class::class);
|
|
|
|
|
return parent::execute($class, $method);
|
2022-01-17 18:45:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|