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

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 33
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1

3 Methods

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