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.

MultiRequest::run()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 11
ccs 9
cts 9
cp 1
crap 1
rs 9.9
c 0
b 0
f 0
1
<?php
2
3
namespace PhpBoot\RPC;
4
5
/**
6
 * 并发执行多个异步请求
7
 *
8
 */
9
class MultiRequest
10
{
11 3
    public static function run(array $threads, callable $waitAll)
12
    {
13 3
        $request = new MultiRequestCore($threads, $waitAll);
14 3
        $id = spl_object_hash($request);
15 3
        self::$contexts[$id] = $request;
16 3
        $oriId = self::$currentContext;
17 3
        self::$currentContext = $id;
18 3
        $request->run();
19 3
        self::$currentContext = $oriId;
20 3
        return $request->getResults();
21
    }
22
23 2
    public static function isRunning(){
24 2
        return !!self::$currentContext;
25
    }
26
27 2
    public static function wait($waitAble)
28
    {
29 2
        self::isRunning() or \PhpBoot\abort("can not call wait() out of MultiRequest::run");
30 2
        $request = self::$contexts[self::$currentContext];
31 2
        return $request->wait($waitAble);
32
    }
33
34
    /**
35
     * @var MultiRequestCore[]
36
     */
37
    protected static $contexts;
38
    protected static $currentContext;
39
40
41
}