Conditions | 8 |
Paths | 9 |
Total Lines | 17 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 8 |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
49 | 3 | public function wait($block = false, $interval = 100) |
|
50 | { |
||
51 | do { |
||
52 | 3 | if ($this->isFinished()) { |
|
53 | 3 | return; |
|
54 | } |
||
55 | 3 | parent::wait(false); |
|
56 | 3 | if ($this->aliveCount() < $this->max) { |
|
57 | 3 | foreach ($this->processes as $process) { |
|
58 | 3 | if ($process->isStarted()) continue; |
|
59 | 3 | $process->start(); |
|
60 | 3 | if ($this->aliveCount() >= $this->max) break; |
|
61 | 3 | } |
|
62 | 3 | } |
|
63 | 3 | $block ? usleep($interval) : null; |
|
64 | 3 | } while ($block); |
|
65 | 3 | } |
|
66 | |||
67 | } |