| Conditions | 6 |
| Paths | 6 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | function wait($commands, $timeout = 8) |
||
| 9 | { |
||
| 10 | if (config('app.env') == 'testing') { |
||
| 11 | return; |
||
| 12 | } |
||
| 13 | |||
| 14 | if (!is_array($commands)) { |
||
| 15 | return wait([$commands], $timeout); |
||
| 16 | } |
||
| 17 | |||
| 18 | $limit = time() + $timeout; |
||
| 19 | foreach ($commands as $command) { |
||
| 20 | while (!Cache::has((string)$command)) { |
||
| 21 | usleep(1000); |
||
| 22 | |||
| 23 | if (time() > $limit) { |
||
| 24 | return; |
||
| 25 | } |
||
| 26 | } |
||
| 27 | } |
||
| 28 | } |
||
| 29 | } |
||
| 40 |