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.

Client   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 4
dl 0
loc 45
ccs 0
cts 18
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A channel() 0 4 1
A channels() 0 10 1
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Client\Pusher;
4
5
use function Clue\React\Block\await;
6
use React\EventLoop\Factory;
7
use React\EventLoop\LoopInterface;
8
use Rx\Observable;
9
10
final class Client
11
{
12
    /**
13
     * @var LoopInterface
14
     */
15
    private $loop;
16
17
    /**
18
     * @var AsyncClient
19
     */
20
    private $client;
21
22
    /**
23
     * @param string $app Application ID
24
     */
25
    public function __construct(string $app)
26
    {
27
        $this->loop = Factory::create();
28
        $this->client = AsyncClient::create($this->loop, $app);
29
    }
30
31
    /**
32
     * @param string   $channel  Channel to listen on
33
     * @param callable $listener Listener to call on new messages
34
     */
35
    public function channel(string $channel, callable $listener): void
36
    {
37
        $this->channels([$channel], $listener);
38
    }
39
40
    /**
41
     * @param string[] $channels Channels to listen on
42
     * @param callable $listener Listener to call on new messages
43
     */
44
    public function channels(array $channels, callable $listener): void
45
    {
46
        $promise = Observable::fromArray($channels)
47
            ->flatMap([$this->client, 'channel'])
48
            ->do($listener)
49
            ->count()
50
            ->toPromise();
51
52
        await($promise, $this->loop);
53
    }
54
}
55