| Conditions | 3 |
| Paths | 2 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | 3 | public function __construct(array $threads, callable $waitAll) |
|
| 15 | { |
||
| 16 | 3 | foreach ($threads as $thread){ |
|
| 17 | 3 | $pos = count($this->threadResults); |
|
| 18 | 3 | $this->threadResults[] = [null,null]; |
|
| 19 | 3 | $this->threads[] = function ()use($thread, $pos){ |
|
| 20 | try{ |
||
| 21 | 3 | $this->threadResults[$pos][0] = $thread(); |
|
| 22 | 3 | }catch (\Exception $e){ |
|
| 23 | 1 | $this->threadResults[$pos][1] = $e; |
|
| 24 | } |
||
| 25 | 3 | }; |
|
| 26 | 3 | } |
|
| 27 | 3 | $this->waitAll = $waitAll; |
|
| 28 | 3 | } |
|
| 29 | |||
| 83 | } |