-
Notifications
You must be signed in to change notification settings - Fork 10
/
RunnerInterface.php
34 lines (29 loc) · 1.13 KB
/
RunnerInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
declare(strict_types=1);
namespace SchedulerBundle\Runner;
use SchedulerBundle\Task\Output;
use SchedulerBundle\Task\TaskInterface;
use SchedulerBundle\Worker\Worker;
use SchedulerBundle\Worker\WorkerInterface;
/**
* @author Guillaume Loulier <contact@guillaumeloulier.fr>
*/
interface RunnerInterface
{
/**
* Execute the @param TaskInterface $task and define an {@see Output} regarding the execution process.
*
* If required, the @param WorkerInterface $worker can be used to execute the task according to the needs.
*
* The {@see TaskInterface::setExecutionState()} method SHOULD NOT be called during the execution process as
* the {@see Worker::defineTaskExecutionState()} does the call, any call of this method BEFORE the worker will be
* ignored and the execution state overridden by the worker.
*/
public function run(TaskInterface $task, WorkerInterface $worker): Output;
/**
* Determine if a @param TaskInterface $task is supported by the runner.
*
* The determination process is totally up to the runner.
*/
public function support(TaskInterface $task): bool;
}