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 ( c17ad1...f97c37 )
by Cees-Jan
07:12
created

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