| Conditions | 3 |
| Paths | 1 |
| Total Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | public static function run(array $threads) |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * 返回以下形式接口 |
||
| 15 | * |
||
| 16 | * [ |
||
| 17 | * [成功值1, null], |
||
| 18 | * [成功值2, null], |
||
| 19 | * [null, 失败异常1], |
||
| 20 | * ... |
||
| 21 | * ] |
||
| 22 | * |
||
| 23 | */ |
||
| 24 | return MultiRequest::run($threads, function($promises){ |
||
| 25 | $res = []; |
||
| 26 | foreach (Promise\settle($promises)->wait() as $i){ |
||
| 27 | if(isset($i['reason'])){ |
||
| 28 | $res[] = [null, new RpcException($i['reason'])]; |
||
| 29 | }else{ |
||
| 30 | $res[] = [$i['value'], null]; |
||
| 31 | } |
||
| 32 | } |
||
| 33 | return $res; |
||
| 34 | }); |
||
| 35 | } |
||
| 36 | |||
| 46 | } |