| Total Complexity | 9 |
| Total Lines | 79 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 9 | class Scheduler implements SchedulerInterface |
||
| 10 | { |
||
| 11 | protected const DELAY_INTERVAL = 1000000; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var JobInterface[] |
||
| 15 | */ |
||
| 16 | protected $jobs; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var JobInterface[] |
||
| 20 | */ |
||
| 21 | protected $runningJobs = []; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Scheduler constructor |
||
| 25 | */ |
||
| 26 | public function __construct() |
||
| 27 | { |
||
| 28 | $this->jobs = []; |
||
| 29 | $this->runningJobs = []; |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @param \Jellyfish\Scheduler\JobInterface $job |
||
| 34 | * |
||
| 35 | * @return \Jellyfish\Scheduler\SchedulerInterface |
||
| 36 | */ |
||
| 37 | public function queueJob(JobInterface $job): SchedulerInterface |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @return \Jellyfish\Scheduler\SchedulerInterface |
||
| 46 | */ |
||
| 47 | public function clearJobs(): SchedulerInterface |
||
| 48 | { |
||
| 49 | $this->jobs = []; |
||
| 50 | |||
| 51 | return $this; |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @return \Jellyfish\Scheduler\SchedulerInterface |
||
| 56 | * |
||
| 57 | * @throws \Exception |
||
| 58 | */ |
||
| 59 | public function run(): SchedulerInterface |
||
| 80 | } |
||
| 81 | |||
| 82 | /** |
||
| 83 | * @return \Jellyfish\Scheduler\JobInterface[] |
||
| 84 | */ |
||
| 85 | public function getQueuedJobs(): array |
||
| 88 | } |
||
| 89 | } |
||
| 90 |