@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | /** |
172 | 172 | * Init queue. |
173 | 173 | */ |
174 | - public function __construct(Database $db, LoggerInterface $logger, array $config = [], ?Emitter $emitter=null) |
|
174 | + public function __construct(Database $db, LoggerInterface $logger, array $config = [], ?Emitter $emitter = null) |
|
175 | 175 | { |
176 | 176 | $this->db = $db; |
177 | 177 | $this->logger = $logger; |
@@ -412,15 +412,15 @@ discard block |
||
412 | 412 | * |
413 | 413 | * @param Process[] $stack |
414 | 414 | */ |
415 | - public function waitFor(array $stack, int $options=0): Scheduler |
|
415 | + public function waitFor(array $stack, int $options = 0): Scheduler |
|
416 | 416 | { |
417 | 417 | $orig = []; |
418 | 418 | $jobs = array_map(function($job) use(&$orig) { |
419 | - if(!($job instanceof Process)) { |
|
419 | + if (!($job instanceof Process)) { |
|
420 | 420 | throw new InvalidArgumentException('waitFor() requires a stack of Process[]'); |
421 | 421 | } |
422 | 422 | |
423 | - $orig[(string)$job->getId()] = $job; |
|
423 | + $orig[(string) $job->getId()] = $job; |
|
424 | 424 | return $job->getId(); |
425 | 425 | }, $stack); |
426 | 426 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | return $this->waitFor($stack, $options); |
441 | 441 | } |
442 | 442 | |
443 | - $this->events->next($cursor, function () use($stack, $options) { |
|
443 | + $this->events->next($cursor, function() use($stack, $options) { |
|
444 | 444 | $this->waitFor($stack, $options); |
445 | 445 | }); |
446 | 446 | |
@@ -448,17 +448,17 @@ discard block |
||
448 | 448 | } |
449 | 449 | |
450 | 450 | $event = $cursor->current(); |
451 | - $this->events->next($cursor, function () use($stack, $options) { |
|
451 | + $this->events->next($cursor, function() use($stack, $options) { |
|
452 | 452 | $this->waitFor($stack, $options); |
453 | 453 | }); |
454 | 454 | |
455 | - $process = $orig[(string)$event['job']]; |
|
455 | + $process = $orig[(string) $event['job']]; |
|
456 | 456 | $data = $process->toArray(); |
457 | 457 | $data['status'] = $event['status']; |
458 | 458 | $process->replace(new Process($data, $this)); |
459 | 459 | $this->emit($process); |
460 | 460 | |
461 | - if($event['status'] < JobInterface::STATUS_DONE) { |
|
461 | + if ($event['status'] < JobInterface::STATUS_DONE) { |
|
462 | 462 | continue; |
463 | 463 | } elseif (JobInterface::STATUS_FAILED === $event['status'] && isset($event['exception']) && $options & self::OPTION_THROW_EXCEPTION) { |
464 | 464 | throw new $event['exception']['class']( |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | |
470 | 470 | $done++; |
471 | 471 | |
472 | - if($done >= $expected) { |
|
472 | + if ($done >= $expected) { |
|
473 | 473 | return $this; |
474 | 474 | } |
475 | 475 | } |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | return $this->listen($callback, $query); |
501 | 501 | } |
502 | 502 | |
503 | - $this->events->next($cursor, function () use ($callback, $query) { |
|
503 | + $this->events->next($cursor, function() use ($callback, $query) { |
|
504 | 504 | return $this->listen($callback, $query); |
505 | 505 | }); |
506 | 506 | |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | } |
509 | 509 | |
510 | 510 | $result = $cursor->current(); |
511 | - $this->events->next($cursor, function () use ($callback, $query) { |
|
511 | + $this->events->next($cursor, function() use ($callback, $query) { |
|
512 | 512 | $this->listen($callback, $query); |
513 | 513 | }); |
514 | 514 | |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | */ |
584 | 584 | public function updateJobProgress(JobInterface $job, float $progress): self |
585 | 585 | { |
586 | - if($progress < 0 || $progress > 100) { |
|
586 | + if ($progress < 0 || $progress > 100) { |
|
587 | 587 | throw new LogicException('progress may only be between 0 to 100'); |
588 | 588 | } |
589 | 589 |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | /** |
83 | 83 | * Init queue. |
84 | 84 | */ |
85 | - public function __construct(Scheduler $scheduler, Database $db, WorkerFactoryInterface $factory, LoggerInterface $logger, ?Emitter $emitter=null) |
|
85 | + public function __construct(Scheduler $scheduler, Database $db, WorkerFactoryInterface $factory, LoggerInterface $logger, ?Emitter $emitter = null) |
|
86 | 86 | { |
87 | 87 | $this->scheduler = $scheduler; |
88 | 88 | $this->db = $db; |
@@ -199,17 +199,17 @@ discard block |
||
199 | 199 | break; |
200 | 200 | } |
201 | 201 | |
202 | - $this->events->next($cursor_events, function () { |
|
202 | + $this->events->next($cursor_events, function() { |
|
203 | 203 | $this->main(); |
204 | 204 | }); |
205 | 205 | } |
206 | 206 | |
207 | 207 | $event = $cursor_events->current(); |
208 | - $this->events->next($cursor_events, function () { |
|
208 | + $this->events->next($cursor_events, function() { |
|
209 | 209 | $this->main(); |
210 | 210 | }); |
211 | 211 | |
212 | - if($event === null) { |
|
212 | + if ($event === null) { |
|
213 | 213 | break; |
214 | 214 | } |
215 | 215 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | break; |
229 | 229 | } |
230 | 230 | |
231 | - $this->jobs->next($cursor_jobs, function () { |
|
231 | + $this->jobs->next($cursor_jobs, function() { |
|
232 | 232 | $this->main(); |
233 | 233 | }); |
234 | 234 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | |
238 | 238 | $job = $cursor_jobs->current(); |
239 | 239 | |
240 | - $this->jobs->next($cursor_jobs, function () { |
|
240 | + $this->jobs->next($cursor_jobs, function() { |
|
241 | 241 | $this->main(); |
242 | 242 | }); |
243 | 243 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | { |
253 | 253 | $this->emit($this->scheduler->getJob($event['job'])); |
254 | 254 | |
255 | - if($event['status'] > JobInterface::STATUS_POSTPONED) { |
|
255 | + if ($event['status'] > JobInterface::STATUS_POSTPONED) { |
|
256 | 256 | $this->logger->debug('received event ['.$event['status'].'] for job ['.$event['job'].'], write into systemv queue', [ |
257 | 257 | 'category' => get_class($this), |
258 | 258 | ]); |
@@ -29,7 +29,7 @@ |
||
29 | 29 | */ |
30 | 30 | public function on(string $event, Closure $handler) |
31 | 31 | { |
32 | - if(!in_array($event, Scheduler::VALID_EVENTS)) { |
|
32 | + if (!in_array($event, Scheduler::VALID_EVENTS)) { |
|
33 | 33 | $name = 'taskscheduler.on'.ucfirst($event); |
34 | 34 | } |
35 | 35 |