GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

MultiRpc::wait()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace PhpBoot\RPC;
4
5
use GuzzleHttp\Promise;
6
7
use PhpBoot\Exceptions\RpcException;
8
9
class MultiRpc
10
{
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
37
    public static function isRunning(){
38
        return MultiRequest::isRunning();
39
    }
40
41
    public static function wait(Promise\Promise $waitAble)
42
    {
43
        return MultiRequest::wait($waitAble);
44
    }
45
46
}