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.
Completed
Push — master ( 78c5cf...93608b )
by Cees-Jan
07:34 queued 05:28
created

OutstandingCalls   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 4
c 1
b 1
f 0
lcom 1
cbo 1
dl 0
loc 44
ccs 12
cts 12
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getCall() 0 4 1
A getNewUniqid() 0 8 2
A newCall() 0 10 1
1
<?php
2
3
namespace WyriHaximus\React\ChildProcess\Messenger;
4
5
class OutstandingCalls
6
{
7
    /**
8
     * @var OutstandingCall[]
9
     */
10
    protected $calls = [];
11
12
    /**
13
     * @param callable $canceller
14
     * @return OutstandingCall
15
     */
16 3
    public function newCall(callable $canceller = null)
17
    {
18 3
        $uniqid = $this->getNewUniqid();
19
20 3
        $this->calls[$uniqid] = new OutstandingCall($uniqid, $canceller, function (OutstandingCall $call) {
21 1
            unset($this->calls[$call->getUniqid()]);
22 3
        });
23
24 3
        return $this->calls[$uniqid];
25
    }
26
27
    /**
28
     * @param string $uniqid
29
     *
30
     * @return OutstandingCall
31
     */
32 2
    public function getCall($uniqid)
33
    {
34 2
        return $this->calls[$uniqid];
35
    }
36
37
    /**
38
     * @return string
39
     */
40 3
    protected function getNewUniqid()
41
    {
42
        do {
43 3
            $uniqid = uniqid('', true);
44 3
        } while (isset($this->calls[$uniqid]));
45
46 3
        return $uniqid;
47
    }
48
}
49