34 lines
592 B
PHP
34 lines
592 B
PHP
<?php
|
|
|
|
namespace Kiri\Task\Annotation;
|
|
|
|
|
|
use Kiri\Annotation\AbstractAttribute;
|
|
use Kiri\Task\TaskContainer;
|
|
|
|
#[\Attribute(\Attribute::TARGET_CLASS)] class AsynchronousTask extends AbstractAttribute
|
|
{
|
|
|
|
|
|
/**
|
|
* @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
|
|
{
|
|
// TODO: Change the autogenerated stub
|
|
di(TaskContainer::class)->add($this->name, $class::class);
|
|
return parent::execute($class, $method);
|
|
}
|
|
|
|
}
|