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 ( ee1be5...1e72ef )
by Cees-Jan
03:09
created

AsyncClient::whoami()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 0
cts 0
cp 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Client\Github;
4
5
use ApiClients\Client\Github\CommandBus\Command;
6
use ApiClients\Foundation\ClientInterface;
7
use ApiClients\Foundation\Factory;
8
use React\EventLoop\LoopInterface;
9
use React\Promise\PromiseInterface;
10
use function React\Promise\resolve;
11
12
final class AsyncClient
13
{
14
    /**
15
     * @var ClientInterface
16
     */
17
    private $client;
18
19
    /**
20
     * @param LoopInterface $loop
21
     * @param AuthenticationInterface $auth
22
     * @param array $options
23
     * @return AsyncClient
24
     */
25
    public static function create(
26
        LoopInterface $loop,
27
        AuthenticationInterface $auth,
28
        array $options = []
29
    ): self {
30
        $options = ApiSettings::getOptions($auth, $options, 'Async');
31
        $client = Factory::create($loop, $options);
32
        return new self($client);
33
    }
34
35
    /**
36
     * @param ClientInterface $client
37
     */
38
    private function __construct(ClientInterface $client)
39
    {
40
        $this->client = $client;
41
    }
42
43
    public function user(string $user): PromiseInterface
44
    {
45
        return $this->client->handle(new Command\UserCommand($user));
46
    }
47
48
    public function whoami(): PromiseInterface
49
    {
50
        return $this->client->handle(new Command\UserCommand());
51
    }
52
}
53