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   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 38
ccs 0
cts 21
cp 0
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 25 3
A isRunning() 0 3 1
A wait() 0 4 1
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
}