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 ( c7fe8d...c9ae62 )
by Cees-Jan
02:47
created

AsyncClient::myOrganizations()   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
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 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 Rx\Observable;
11
use function ApiClients\Tools\Rx\unwrapObservableFromPromise;
12
use function React\Promise\resolve;
13
14
final class AsyncClient
15
{
16
    /**
17
     * @var ClientInterface
18
     */
19
    private $client;
20
21
    /**
22
     * @param LoopInterface $loop
23
     * @param AuthenticationInterface $auth
24
     * @param array $options
25
     * @return AsyncClient
26
     */
27
    public static function create(
28
        LoopInterface $loop,
29
        AuthenticationInterface $auth,
30
        array $options = []
31
    ): self {
32
        $options = ApiSettings::getOptions($auth, $options, 'Async');
33
        $client = Factory::create($loop, $options);
34
        return new self($client);
35
    }
36
37
    /**
38
     * @param ClientInterface $client
39
     */
40
    private function __construct(ClientInterface $client)
41
    {
42
        $this->client = $client;
43
    }
44
45
    public function user(string $user): PromiseInterface
46
    {
47
        return $this->client->handle(new Command\UserCommand($user));
48
    }
49
50
    public function whoami(): PromiseInterface
51
    {
52
        return $this->client->handle(new Command\UserCommand());
53
    }
54
55
    public function myOrganizations(): Observable
56
    {
57
        return unwrapObservableFromPromise($this->client->handle(new Command\MyOrganizationsCommand()));
58
    }
59
}
60