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 ( 5a937f...dd0aba )
by Cees-Jan
16s queued 10s
created

Repository::pullRequests()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
ccs 0
cts 5
cp 0
cc 1
nc 1
nop 0
crap 2
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Client\Github\Resource\Async;
4
5
use ApiClients\Client\Github\CommandBus\Command\RefreshCommand;
6
use ApiClients\Client\Github\CommandBus\Command\Repository\AddLabelCommand;
7
use ApiClients\Client\Github\CommandBus\Command\Repository\AddWebHookCommand;
8
use ApiClients\Client\Github\CommandBus\Command\Repository\AppVeyorCommand;
9
use ApiClients\Client\Github\CommandBus\Command\Repository\BlobCommand;
10
use ApiClients\Client\Github\CommandBus\Command\Repository\BranchesCommand;
11
use ApiClients\Client\Github\CommandBus\Command\Repository\CommitCommand;
12
use ApiClients\Client\Github\CommandBus\Command\Repository\CommitsCommand;
13
use ApiClients\Client\Github\CommandBus\Command\Repository\CommunityHealthCommand;
14
use ApiClients\Client\Github\CommandBus\Command\Repository\Contents\FileUploadCommand;
15
use ApiClients\Client\Github\CommandBus\Command\Repository\ContentsCommand;
16
use ApiClients\Client\Github\CommandBus\Command\Repository\DetailedCommitCommand;
17
use ApiClients\Client\Github\CommandBus\Command\Repository\LabelsCommand;
18
use ApiClients\Client\Github\CommandBus\Command\Repository\LanguagesCommand;
19
use ApiClients\Client\Github\CommandBus\Command\Repository\MilestonesCommand;
20
use ApiClients\Client\Github\CommandBus\Command\Repository\PullRequestsCommand;
21
use ApiClients\Client\Github\CommandBus\Command\Repository\RefCommand;
22
use ApiClients\Client\Github\CommandBus\Command\Repository\RefsCommand;
23
use ApiClients\Client\Github\CommandBus\Command\Repository\ReleasesCommand;
24
use ApiClients\Client\Github\CommandBus\Command\Repository\ReplaceTopicsCommand;
25
use ApiClients\Client\Github\CommandBus\Command\Repository\ScrutinizerCommand;
26
use ApiClients\Client\Github\CommandBus\Command\Repository\SubscribeCommand;
27
use ApiClients\Client\Github\CommandBus\Command\Repository\TagsCommand;
28
use ApiClients\Client\Github\CommandBus\Command\Repository\TravisCommand;
29
use ApiClients\Client\Github\CommandBus\Command\Repository\TreeCommand;
30
use ApiClients\Client\Github\CommandBus\Command\Repository\UnSubscribeCommand;
31
use ApiClients\Client\Github\CommandBus\Command\Repository\UpdateSettingsCommand;
32
use ApiClients\Client\Github\CommandBus\Command\WebHooksCommand;
33
use ApiClients\Client\Github\Resource\Git\CommitInterface;
34
use ApiClients\Client\Github\Resource\Git\RefInterface;
35
use ApiClients\Client\Github\Resource\Git\TreeInterface;
36
use ApiClients\Client\Github\Resource\Repository as BaseRepository;
37
use ApiClients\Client\Github\VO\NamedBlob;
38
use function ApiClients\Tools\Rx\unwrapObservableFromPromise;
39
use React\Promise\PromiseInterface;
40
use React\Stream\ReadableStreamInterface;
41
use Rx\Observable;
42
use Rx\ObservableInterface;
43
44
class Repository extends BaseRepository
45
{
46
    public function refresh(): PromiseInterface
47
    {
48
        return $this->handleCommand(
49
            new RefreshCommand($this)
50
        );
51
    }
52
53
    public function branches(): ObservableInterface
54
    {
55
        return unwrapObservableFromPromise($this->handleCommand(
56
            new BranchesCommand($this->fullName())
57
        ));
58
    }
59
60
    public function commits(): ObservableInterface
61
    {
62
        return unwrapObservableFromPromise($this->handleCommand(
63
            new CommitsCommand($this->fullName())
64
        ));
65
    }
66
67
    public function specificCommit(string $sha): PromiseInterface
68
    {
69
        return $this->handleCommand(
70
            new DetailedCommitCommand(
71
                $this->fullName(),
72
                $sha
73
            )
74
        );
75
    }
76
77
    public function labels(): ObservableInterface
78
    {
79
        return unwrapObservableFromPromise($this->handleCommand(
80
            new LabelsCommand($this->fullName())
81
        ));
82
    }
83
84
    public function addLabel(string $name, string $colour): PromiseInterface
85
    {
86
        return $this->handleCommand(
87
            new AddLabelCommand($this->fullName(), $name, $colour)
88
        );
89
    }
90
91
    public function contents(string $path = '/'): Observable
92
    {
93
        return unwrapObservableFromPromise(
94
            $this->handleCommand(
95
                new ContentsCommand($this->fullName(), $path)
96
            )
97
        );
98
    }
99
100
    public function communityHealth(): PromiseInterface
101
    {
102
        return $this->handleCommand(
103
            new CommunityHealthCommand($this->fullName())
104
        );
105
    }
106
107
    public function tags(): ObservableInterface
108
    {
109
        return unwrapObservableFromPromise($this->handleCommand(
110
            new TagsCommand($this->fullName())
111
        ));
112
    }
113
114
    public function releases(): ObservableInterface
115
    {
116
        return unwrapObservableFromPromise($this->handleCommand(
117
            new ReleasesCommand($this->fullName())
118
        ));
119
    }
120
121
    public function languages(): PromiseInterface
122
    {
123
        return $this->handleCommand(
124
            new LanguagesCommand($this->fullName())
125
        );
126
    }
127
128
    public function webHooks(): ObservableInterface
129
    {
130
        return unwrapObservableFromPromise($this->handleCommand(
131
            new WebHooksCommand($this->fullName(), 'repos')
132
        ));
133
    }
134
135
    public function milestones(): ObservableInterface
136
    {
137
        return unwrapObservableFromPromise($this->handleCommand(
138
            new MilestonesCommand($this->fullName())
139
        ));
140
    }
141
142
    public function pullRequests(): ObservableInterface
143
    {
144
        return unwrapObservableFromPromise($this->handleCommand(
145
            new PullRequestsCommand($this->fullName())
146
        ));
147
    }
148
149
    public function addWebHook(
150
        string $name,
151
        array $config,
152
        array $events,
153
        bool $active
154
    ): PromiseInterface {
155
        return $this->handleCommand(
156
            new AddWebHookCommand(
157
                $this->fullName(),
158
                $name,
159
                $config,
160
                $events,
161
                $active
162
            )
163
        );
164
    }
165
166
    public function addFile(
167
        string $filename,
168
        ReadableStreamInterface $stream,
169
        string $commitMessage = '',
170
        string $branch = ''
171
    ): PromiseInterface {
172
        if ($commitMessage === '') {
173
            $commitMessage = 'Update ' . $this->name;
174
        }
175
176
        return $this->handleCommand(new FileUploadCommand(
177
            $this->full_name,
178
            $commitMessage,
179
            '/repos/' . $this->full_name . '/contents/' . $filename,
180
            '',
181
            $branch,
182
            $stream
183
        ));
184
    }
185
186
    public function subscribe(bool $subscribed = true, bool $ignored = false): PromiseInterface
187
    {
188
        return $this->handleCommand(
189
            new SubscribeCommand($this->fullName(), $subscribed, $ignored)
190
        );
191
    }
192
193
    public function unSubscribe(): PromiseInterface
194
    {
195
        return $this->handleCommand(
196
            new UnSubscribeCommand($this->fullName())
197
        );
198
    }
199
200
    public function replaceTopics(string ...$topics): PromiseInterface
201
    {
202
        return $this->handleCommand(
203
            new ReplaceTopicsCommand($this->fullName(), ...$topics)
204
        );
205
    }
206
207
    public function travisRepository(): PromiseInterface
208
    {
209
        return $this->handleCommand(new TravisCommand($this->fullName()));
210
    }
211
212
    public function appVeyorRepository(): PromiseInterface
213
    {
214
        return $this->handleCommand(new AppVeyorCommand($this->fullName()));
215
    }
216
217
    public function scrutinizerRepository(): PromiseInterface
218
    {
219
        return $this->handleCommand(new ScrutinizerCommand(...\explode('/', $this->fullName())));
0 ignored issues
show
Bug introduced by
The call to ScrutinizerCommand::__construct() misses a required argument $name.

This check looks for function calls that miss required arguments.

Loading history...
Documentation introduced by
\explode('/', $this->fullName()) is of type array, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
220
    }
221
222
    public function updateSettings(array $settings): PromiseInterface
223
    {
224
        if (!isset($settings['name'])) {
225
            $settings['name'] = $this->name();
226
        }
227
228
        return $this->handleCommand(new UpdateSettingsCommand($this->fullName(), $settings));
229
    }
230
231
    public function blob(ReadableStreamInterface $contents): PromiseInterface
232
    {
233
        return $this->handleCommand(new BlobCommand($this->fullName(), $contents));
234
    }
235
236
    public function tree(?string $baseTree, NamedBlob ...$blobs): PromiseInterface
237
    {
238
        return $this->handleCommand(new TreeCommand($this->fullName(), $baseTree, ...$blobs));
239
    }
240
241
    public function commit(string $message, TreeInterface $tree, ?string ...$baseCommits): PromiseInterface
242
    {
243
        return $this->handleCommand(new CommitCommand($this->fullName(), $message, $tree->sha(), ...$baseCommits));
244
    }
245
246
    public function refs(?string $namespace = null): ObservableInterface
247
    {
248
        return unwrapObservableFromPromise($this->handleCommand(
249
            new RefsCommand($this->fullName(), $namespace)
250
        ));
251
    }
252
253
    public function ref(RefInterface $ref, CommitInterface $tree): PromiseInterface
254
    {
255
        return $this->handleCommand(new RefCommand($this->fullName(), $ref->ref(), $tree->sha()));
256
    }
257
}
258