| Conditions | 3 |
| Paths | 4 |
| Total Lines | 29 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 3 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | 3 | public function startProcess( |
|
| 13 | string $phpPath, |
||
| 14 | string $queueName, |
||
| 15 | ?string $connection, |
||
| 16 | bool $specifyQueue, |
||
| 17 | int $timeout, |
||
| 18 | int $sleep, |
||
| 19 | int $tries |
||
| 20 | ): int { |
||
| 21 | 3 | $command = $phpPath; |
|
| 22 | 3 | $command .= ' artisan queue:work'; |
|
| 23 | |||
| 24 | 3 | if (null !== $connection) { |
|
| 25 | 1 | $command .= ' ' . $connection; |
|
| 26 | } |
||
| 27 | |||
| 28 | 3 | if ($specifyQueue) { |
|
| 29 | 3 | $command .= ' --queue ' . $queueName; |
|
| 30 | } |
||
| 31 | |||
| 32 | 3 | $command .= ' --timeout ' . $timeout; |
|
| 33 | 3 | $command .= ' --sleep ' . $sleep; |
|
| 34 | 3 | $command .= ' --tries ' . $tries; |
|
| 35 | |||
| 36 | // Suppress output and return PID |
||
| 37 | 3 | $command .= ' > /dev/null & echo $!'; |
|
| 38 | |||
| 39 | 3 | return (int) exec( |
|
| 40 | 3 | $command |
|
| 41 | ); |
||
| 49 |