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 ( 78ea24...4a847b )
by Cees-Jan
07:54
created

Client::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Pusher;
4
5
use React\EventLoop\Factory;
6
use React\Promise\Deferred;
7
use Rx\Observer\CallbackObserver;
8
use function Clue\React\Block\await;
9
10
class Client
11
{
12
    protected $loop;
13
    protected $client;
14
15
    public function __construct(string $app)
16
    {
17
        $this->loop = Factory::create();
18
        $this->client = new AsyncClient($this->loop, $app);
19
    }
20
21
    public function channel(string $channel, callable $listener)
22
    {
23
        $this->channels(
24
            [
25
                $channel,
26
            ],
27
            $listener
28
        );
29
    }
30
31
    public function channels(array $channels, callable $listener)
32
    {
33
        $deferred = new Deferred();
34
        foreach ($channels as $channel) {
35
            $this->client->channel($channel)->subscribe(
36
                new CallbackObserver(
37
                    $listener,
38
                    null,
39
                    function () use ($deferred) {
40
                        $deferred->resolve();
41
                    }
42
                )
43
            );
44
        }
45
        await(
46
            $deferred->promise(),
47
            $this->loop
48
        );
49
    }
50
}
51