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 ( 5de759...4f105b )
by Cees-Jan
10:01
created

Client::readLog()   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 2
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ApiClients\Client\Supervisord;
6
7
use ApiClients\Client\Supervisord\Resource\StateInterface;
8
use ApiClients\Foundation\Factory as FoundationClientFactory;
9
use React\EventLoop\Factory;
10
use React\EventLoop\LoopInterface;
11
use Rx\React\Promise;
12
use function ApiClients\Tools\Rx\setAsyncScheduler;
13
use function Clue\React\Block\await;
14
15
final class Client implements ClientInterface
16
{
17
    /**
18
     * @var LoopInterface
19
     */
20
    private $loop;
21
    /**
22
     * @var AsyncClient
23
     */
24
    private $client;
25
26
    /**
27
     * @param LoopInterface $loop
28
     * @param AsyncClient   $client
29
     */
30
    private function __construct(LoopInterface $loop, AsyncClient $client)
31
    {
32
        $this->loop = $loop;
33
        $this->client = $client;
34
    }
35
36
    /**
37
     * @param  array  $options
38
     * @return Client
39
     */
40
    public static function create(string $host, array $options = []): self
41
    {
42
        $loop = Factory::create();
43
        $options = ApiSettings::getOptions($host, $options, 'Sync');
44
        $client = FoundationClientFactory::create($loop, $options);
45
        setAsyncScheduler($loop);
46
        $asyncClient = AsyncClient::createFromClient($client);
47
48
        return new self($loop, $asyncClient);
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function APIVersion(): string
55
    {
56
        return await(
57
            $this->client->APIVersion(),
58
            $this->loop
59
        );
60
    }
61
62
    /**
63
     * @return string
64
     */
65
    public function version(): string
66
    {
67
        return await(
68
            $this->client->version(),
69
            $this->loop
70
        );
71
    }
72
73
    /**
74
     * @return string
75
     */
76
    public function identification(): string
77
    {
78
        return await(
79
            $this->client->identification(),
80
            $this->loop
81
        );
82
    }
83
84
    /**
85
     * @return StateInterface
86
     */
87
    public function state(): StateInterface
88
    {
89
        return await(
90
            $this->client->state(),
91
            $this->loop
92
        );
93
    }
94
95
    /**
96
     * @return string
97
     */
98
    public function readLog(int $offset = 0, int $length = 0): string
99
    {
100
        return await(
101
            $this->client->readLog($offset, $length),
102
            $this->loop
103
        );
104
    }
105
106
    /**
107
     * @return bool
108
     */
109
    public function clearLog(): bool
110
    {
111
        return await(
112
            $this->client->clearLog(),
113
            $this->loop
114
        );
115
    }
116
117
    /**
118
     * @return int
119
     */
120
    public function pid(): int
121
    {
122
        return await(
123
            $this->client->pid(),
124
            $this->loop
125
        );
126
    }
127
128
    /**
129
     * @return bool
130
     */
131
    public function restart(): bool
132
    {
133
        return await(
134
            $this->client->restart(),
135
            $this->loop
136
        );
137
    }
138
139
    /**
140
     * @return bool
141
     */
142
    public function shutdown(): bool
143
    {
144
        return await(
145
            $this->client->shutdown(),
146
            $this->loop
147
        );
148
    }
149
150
    /**
151
     * @return array
152
     */
153
    public function programs(): array
154
    {
155
        return await(
156
            Promise::fromObservable(
157
                $this->client->programs()->toArray()
158
            ),
159
            $this->loop
160
        );
161
    }
162
}
163