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 ( f97c37...7f1b36 )
by Cees-Jan
10:16
created

Repository::ref()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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