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
Pull Request — master (#64)
by Cees-Jan
09:07
created

Repository   A

Complexity

Total Complexity 29

Size/Duplication

Total Lines 207
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 31

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 29
lcom 1
cbo 31
dl 0
loc 207
rs 10
c 0
b 0
f 0
ccs 0
cts 67
cp 0

27 Methods

Rating   Name   Duplication   Size   Complexity  
A refresh() 0 6 1
A branches() 0 6 1
A commits() 0 6 1
A specificCommit() 0 9 1
A labels() 0 6 1
A addLabel() 0 6 1
A contents() 0 8 1
A communityHealth() 0 6 1
A tags() 0 6 1
A releases() 0 6 1
A languages() 0 6 1
A webHooks() 0 6 1
A milestones() 0 6 1
A addWebHook() 0 16 1
A addFile() 0 19 2
A subscribe() 0 6 1
A unSubscribe() 0 6 1
A replaceTopics() 0 6 1
A travisRepository() 0 4 1
A appVeyorRepository() 0 4 1
A scrutinizerRepository() 0 4 1
A updateSettings() 0 8 2
A blob() 0 4 1
A tree() 0 4 1
A commit() 0 4 1
A refs() 0 6 1
A ref() 0 4 1
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\RefCommand;
21
use ApiClients\Client\Github\CommandBus\Command\Repository\RefsCommand;
22
use ApiClients\Client\Github\CommandBus\Command\Repository\ReleasesCommand;
23
use ApiClients\Client\Github\CommandBus\Command\Repository\ReplaceTopicsCommand;
24
use ApiClients\Client\Github\CommandBus\Command\Repository\ScrutinizerCommand;
25
use ApiClients\Client\Github\CommandBus\Command\Repository\SubscribeCommand;
26
use ApiClients\Client\Github\CommandBus\Command\Repository\TagsCommand;
27
use ApiClients\Client\Github\CommandBus\Command\Repository\TravisCommand;
28
use ApiClients\Client\Github\CommandBus\Command\Repository\TreeCommand;
29
use ApiClients\Client\Github\CommandBus\Command\Repository\UnSubscribeCommand;
30
use ApiClients\Client\Github\CommandBus\Command\Repository\UpdateSettingsCommand;
31
use ApiClients\Client\Github\CommandBus\Command\WebHooksCommand;
32
use ApiClients\Client\Github\Resource\Git\CommitInterface;
33
use ApiClients\Client\Github\Resource\Git\RefInterface;
34
use ApiClients\Client\Github\Resource\Git\TreeInterface;
35
use ApiClients\Client\Github\Resource\Repository as BaseRepository;
36
use ApiClients\Client\Github\VO\NamedBlob;
37
use function ApiClients\Tools\Rx\unwrapObservableFromPromise;
38
use React\Promise\PromiseInterface;
39
use React\Stream\ReadableStreamInterface;
40
use Rx\Observable;
41
use Rx\ObservableInterface;
42
43
class Repository extends BaseRepository
44
{
45
    public function refresh(): PromiseInterface
46
    {
47
        return $this->handleCommand(
48
            new RefreshCommand($this)
49
        );
50
    }
51
52
    public function branches(): ObservableInterface
53
    {
54
        return unwrapObservableFromPromise($this->handleCommand(
55
            new BranchesCommand($this->fullName())
56
        ));
57
    }
58
59
    public function commits(): ObservableInterface
60
    {
61
        return unwrapObservableFromPromise($this->handleCommand(
62
            new CommitsCommand($this->fullName())
63
        ));
64
    }
65
66
    public function specificCommit(string $sha): PromiseInterface
67
    {
68
        return $this->handleCommand(
69
            new DetailedCommitCommand(
70
                $this->fullName(),
71
                $sha
72
            )
73
        );
74
    }
75
76
    public function labels(): ObservableInterface
77
    {
78
        return unwrapObservableFromPromise($this->handleCommand(
79
            new LabelsCommand($this->fullName())
80
        ));
81
    }
82
83
    public function addLabel(string $name, string $colour): PromiseInterface
84
    {
85
        return $this->handleCommand(
86
            new AddLabelCommand($this->fullName(), $name, $colour)
87
        );
88
    }
89
90
    public function contents(string $path = '/'): Observable
91
    {
92
        return unwrapObservableFromPromise(
93
            $this->handleCommand(
94
                new ContentsCommand($this->fullName(), $path)
95
            )
96
        );
97
    }
98
99
    public function communityHealth(): PromiseInterface
100
    {
101
        return $this->handleCommand(
102
            new CommunityHealthCommand($this->fullName())
103
        );
104
    }
105
106
    public function tags(): ObservableInterface
107
    {
108
        return unwrapObservableFromPromise($this->handleCommand(
109
            new TagsCommand($this->fullName())
110
        ));
111
    }
112
113
    public function releases(): ObservableInterface
114
    {
115
        return unwrapObservableFromPromise($this->handleCommand(
116
            new ReleasesCommand($this->fullName())
117
        ));
118
    }
119
120
    public function languages(): PromiseInterface
121
    {
122
        return $this->handleCommand(
123
            new LanguagesCommand($this->fullName())
124
        );
125
    }
126
127
    public function webHooks(): ObservableInterface
128
    {
129
        return unwrapObservableFromPromise($this->handleCommand(
130
            new WebHooksCommand($this->fullName(), 'repos')
131
        ));
132
    }
133
134
    public function milestones(): ObservableInterface
135
    {
136
        return unwrapObservableFromPromise($this->handleCommand(
137
            new MilestonesCommand($this->fullName())
138
        ));
139
    }
140
141
    public function addWebHook(
142
        string $name,
143
        array $config,
144
        array $events,
145
        bool $active
146
    ): PromiseInterface {
147
        return $this->handleCommand(
148
            new AddWebHookCommand(
149
                $this->fullName(),
150
                $name,
151
                $config,
152
                $events,
153
                $active
154
            )
155
        );
156
    }
157
158
    public function addFile(
159
        string $filename,
160
        ReadableStreamInterface $stream,
161
        string $commitMessage = '',
162
        string $branch = ''
163
    ): PromiseInterface {
164
        if ($commitMessage === '') {
165
            $commitMessage = 'Update ' . $this->name;
166
        }
167
168
        return $this->handleCommand(new FileUploadCommand(
169
            $this->full_name,
170
            $commitMessage,
171
            '/repos/' . $this->full_name . '/contents/' . $filename,
172
            '',
173
            $branch,
174
            $stream
175
        ));
176
    }
177
178
    public function subscribe(bool $subscribed = true, bool $ignored = false): PromiseInterface
179
    {
180
        return $this->handleCommand(
181
            new SubscribeCommand($this->fullName(), $subscribed, $ignored)
182
        );
183
    }
184
185
    public function unSubscribe(): PromiseInterface
186
    {
187
        return $this->handleCommand(
188
            new UnSubscribeCommand($this->fullName())
189
        );
190
    }
191
192
    public function replaceTopics(string ...$topics): PromiseInterface
193
    {
194
        return $this->handleCommand(
195
            new ReplaceTopicsCommand($this->fullName(), ...$topics)
196
        );
197
    }
198
199
    public function travisRepository(): PromiseInterface
200
    {
201
        return $this->handleCommand(new TravisCommand($this->fullName()));
202
    }
203
204
    public function appVeyorRepository(): PromiseInterface
205
    {
206
        return $this->handleCommand(new AppVeyorCommand($this->fullName()));
207
    }
208
209
    public function scrutinizerRepository(): PromiseInterface
210
    {
211
        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...
212
    }
213
214
    public function updateSettings(array $settings): PromiseInterface
215
    {
216
        if (!isset($settings['name'])) {
217
            $settings['name'] = $this->name();
218
        }
219
220
        return $this->handleCommand(new UpdateSettingsCommand($this->fullName(), $settings));
221
    }
222
223
    public function blob(ReadableStreamInterface $contents): PromiseInterface
224
    {
225
        return $this->handleCommand(new BlobCommand($this->fullName(), $contents));
226
    }
227
228
    public function tree(?string $baseTree, NamedBlob ...$blobs): PromiseInterface
229
    {
230
        return $this->handleCommand(new TreeCommand($this->fullName(), $baseTree, ...$blobs));
231
    }
232
233
    public function commit(string $message, TreeInterface $tree, ?string ...$baseCommits): PromiseInterface
234
    {
235
        return $this->handleCommand(new CommitCommand($this->fullName(), $message, $tree->sha(), ...$baseCommits));
236
    }
237
238
    public function refs(?string $namespace = null): ObservableInterface
239
    {
240
        return unwrapObservableFromPromise($this->handleCommand(
241
            new RefsCommand($this->fullName(), $namespace)
242
        ));
243
    }
244
245
    public function ref(RefInterface $ref, CommitInterface $tree): PromiseInterface
246
    {
247
        return $this->handleCommand(new RefCommand($this->fullName(), $ref->ref(), $tree->sha()));
248
    }
249
}
250