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   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 35
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 9 2
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