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 ( d9d099...27afaf )
by Cees-Jan
09:18
created

Client::identification()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 0
cts 7
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ApiClients\Client\Supervisord;
6
7
use ApiClients\Foundation\Factory as FoundationClientFactory;
8
use React\EventLoop\Factory;
9
use React\EventLoop\LoopInterface;
10
use Rx\React\Promise;
11
use function ApiClients\Tools\Rx\setAsyncScheduler;
12
use function Clue\React\Block\await;
13
14
final class Client implements ClientInterface
15
{
16
    /**
17
     * @var LoopInterface
18
     */
19
    private $loop;
20
    /**
21
     * @var AsyncClient
22
     */
23
    private $client;
24
25
    /**
26
     * @param LoopInterface $loop
27
     * @param AsyncClient   $client
28
     */
29
    private function __construct(LoopInterface $loop, AsyncClient $client)
30
    {
31
        $this->loop = $loop;
32
        $this->client = $client;
33
    }
34
35
    /**
36
     * @param  array  $options
37
     * @return Client
38
     */
39
    public static function create(string $host, array $options = []): self
40
    {
41
        $loop = Factory::create();
42
        $options = ApiSettings::getOptions($host, $options, 'Sync');
43
        $client = FoundationClientFactory::create($loop, $options);
44
        setAsyncScheduler($loop);
45
        $asyncClient = AsyncClient::createFromClient($client);
46
47
        return new self($loop, $asyncClient);
48
    }
49
50
    /**
51
     * @return string
52
     */
53
    public function APIVersion(): string
54
    {
55
        return await(
56
            $this->client->APIVersion(),
57
            $this->loop
58
        );
59
    }
60
61
    /**
62
     * @return string
63
     */
64
    public function version(): string
65
    {
66
        return await(
67
            $this->client->version(),
68
            $this->loop
69
        );
70
    }
71
72
    /**
73
     * @return string
74
     */
75
    public function identification(): string
76
    {
77
        return await(
78
            $this->client->identification(),
79
            $this->loop
80
        );
81
    }
82
83
    /**
84
     * @return int
85
     */
86
    public function pid(): int
87
    {
88
        return await(
89
            $this->client->pid(),
90
            $this->loop
91
        );
92
    }
93
94
    /**
95
     * @return bool
96
     */
97
    public function restart(): bool
98
    {
99
        return await(
100
            $this->client->restart(),
101
            $this->loop
102
        );
103
    }
104
105
    /**
106
     * @return bool
107
     */
108
    public function shutdown(): bool
109
    {
110
        return await(
111
            $this->client->shutdown(),
112
            $this->loop
113
        );
114
    }
115
116
    /**
117
     * @return array
118
     */
119
    public function programs(): array
120
    {
121
        return await(
122
            Promise::fromObservable(
123
                $this->client->programs()->toArray()
124
            ),
125
            $this->loop
126
        );
127
    }
128
}
129