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.

OutstandingCall::getUniqid()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
ccs 1
cts 1
cp 1
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WyriHaximus\React\ChildProcess\Messenger;
6
7
use Closure;
8
use React\Promise\Deferred;
9
10
use function is_callable;
11
12
final class OutstandingCall implements OutstandingCallInterface
13
{
14
    protected string $uniqid;
15
16
    protected Deferred $deferred;
17
18
    /** @var callable */
19
    protected $cleanup;
20
21
    /** @phpstan-ignore-next-line */
22
    public function __construct(string $uniqid, ?Closure $canceller = null, ?callable $cleanup = null) /** @phpstan-ignore-line */
23
    {
24
        if ($canceller !== null) {
25
            $canceller = Closure::bind($canceller, $this, self::class);
26
        }
27
28 4
        $this->uniqid   = $uniqid;
29
        $this->deferred = new Deferred($canceller);
30 4
31 3
        if (! is_callable($cleanup)) {
32
            $cleanup = static function (): void {
33
            };
34 4
        }
35 4
36
        $this->cleanup = $cleanup;
37 4
    }
38 1
39 1
    /**
40
     * @return mixed
41 4
     */
42 4
    public function getUniqid()
43
    {
44
        return $this->uniqid;
45
    }
46
47 4
    public function getDeferred(): Deferred
48
    {
49 4
        return $this->deferred;
50
    }
51
52
    /**
53
     * @param mixed $value
54
     */
55 3
    public function resolve($value): void
56
    {
57 3
        $cleanup = $this->cleanup;
58
        $cleanup($this);
59
60
        $this->deferred->resolve($value);
61
    }
62
63 1
    /**
64
     * @param mixed $value
65 1
     */
66 1
    public function reject($value): void
67
    {
68 1
        $cleanup = $this->cleanup;
69
        $cleanup($this);
70
71
        $this->deferred->reject($value);
72
    }
73
}
74