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 ( 8bb484...09928a )
by Cees-Jan
09:51
created

SharedAppClientService::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Client\Pusher\Service;
4
5
use ApiClients\Client\Pusher\AsyncClient;
6
use ApiClients\Foundation\Service\ServiceInterface;
7
use React\EventLoop\LoopInterface;
8
use React\Promise\CancellablePromiseInterface;
9
use function React\Promise\resolve;
10
use function WyriHaximus\React\futureFunctionPromise;
11
12
final class SharedAppClientService implements ServiceInterface
13
{
14
    /**
15
     * @var LoopInterface
16
     */
17
    private $loop;
18
19
    /**
20
     * @var array
21
     */
22
    private $apps = [];
23
24
    /**
25
     * SharedAppClientHandler constructor.
26
     * @param LoopInterface $loop
27
     */
28
    public function __construct(LoopInterface $loop)
29
    {
30
        $this->loop = $loop;
31
    }
32
33
    /**
34
     * @param string|null $appId
35
     * @return CancellablePromiseInterface
36
     */
37
    public function handle(string $appId = null): CancellablePromiseInterface
38
    {
39
        if (isset($this->apps[$appId])) {
40
            return resolve($this->apps[$appId]);
41
        }
42
43
        $this->apps[$appId] = new AsyncClient($this->loop, $appId);
44
        return resolve($this->apps[$appId]);
45
    }
46
}
47