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 ( afc5ea...828b9a )
by Cees-Jan
23:31 queued 06:50
created

OutstandingCall   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 86
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 69.23%

Importance

Changes 0
Metric Value
wmc 8
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 86
ccs 18
cts 26
cp 0.6923
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getUniqid() 0 4 1
A getDeferred() 0 4 1
A resolve() 0 7 1
A __construct() 0 15 3
A progress() 0 7 1
A reject() 0 7 1
1
<?php
2
3
namespace WyriHaximus\React\ChildProcess\Messenger;
4
5
use React\Promise\Deferred;
6
7
class OutstandingCall
8
{
9
    /**
10
     * @var string
11
     */
12
    protected $uniqid;
13
14
    /**
15
     * @var Deferred
16
     */
17
    protected $deferred;
18
19
    /**
20
     * @var callable
21
     */
22
    protected $cleanup;
23
24
    /**
25
     * @param string   $uniqid
26
     * @param callable $canceller
27
     */
28 4
    public function __construct($uniqid, callable $canceller = null, callable $cleanup = null)
29
    {
30 4
        if ($canceller !== null) {
31 3
            $canceller = \Closure::bind($canceller, $this, 'WyriHaximus\React\ChildProcess\Messenger\OutstandingCall');
32
        }
33
34 4
        $this->uniqid = $uniqid;
35 4
        $this->deferred = new Deferred($canceller);
36
37 4
        if (!is_callable($cleanup)) {
38 1
            $cleanup = function () {
39 1
            };
40
        }
41 4
        $this->cleanup = $cleanup;
42 4
    }
43
44
    /**
45
     * @return mixed
46
     */
47 4
    public function getUniqid()
48
    {
49 4
        return $this->uniqid;
50
    }
51
52
    /**
53
     * @return Deferred
54
     */
55 3
    public function getDeferred()
56
    {
57 3
        return $this->deferred;
58
    }
59
60
    /**
61
     * @param mixed $value
62
     */
63 1
    public function resolve($value)
64
    {
65 1
        $cleanup = $this->cleanup;
66 1
        $cleanup($this);
67
68 1
        return $this->deferred->resolve($value);
69
    }
70
71
    /**
72
     * @param mixed $value
73
     */
74
    public function progress($value)
75
    {
76
        $cleanup = $this->cleanup;
77
        $cleanup($this);
78
79
        return $this->deferred->progress($value);
0 ignored issues
show
Deprecated Code introduced by
The method React\Promise\Deferred::progress() has been deprecated with message: 2.2.0

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
80
    }
81
82
    /**
83
     * @param mixed $value
84
     */
85
    public function reject($value)
86
    {
87
        $cleanup = $this->cleanup;
88
        $cleanup($this);
89
90
        return $this->deferred->reject($value);
91
    }
92
}
93