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 (#20)
by Cees-Jan
08:07 queued 05:24
created

Repository::releases()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 3
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
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\AppVeyorCommand;
8
use ApiClients\Client\Github\CommandBus\Command\Repository\BranchesCommand;
9
use ApiClients\Client\Github\CommandBus\Command\Repository\CommitsCommand;
10
use ApiClients\Client\Github\CommandBus\Command\Repository\CommunityHealthCommand;
11
use ApiClients\Client\Github\CommandBus\Command\Repository\Contents\FileUploadCommand;
12
use ApiClients\Client\Github\CommandBus\Command\Repository\ContentsCommand;
13
use ApiClients\Client\Github\CommandBus\Command\Repository\LabelsCommand;
14
use ApiClients\Client\Github\CommandBus\Command\Repository\LanguagesCommand;
15
use ApiClients\Client\Github\CommandBus\Command\Repository\ReleasesCommand;
16
use ApiClients\Client\Github\CommandBus\Command\Repository\ReplaceTopicsCommand;
17
use ApiClients\Client\Github\CommandBus\Command\Repository\ScrutinizerCommand;
18
use ApiClients\Client\Github\CommandBus\Command\Repository\SubscribeCommand;
19
use ApiClients\Client\Github\CommandBus\Command\Repository\TagsCommand;
20
use ApiClients\Client\Github\CommandBus\Command\Repository\TravisCommand;
21
use ApiClients\Client\Github\CommandBus\Command\Repository\UnSubscribeCommand;
22
use ApiClients\Client\Github\CommandBus\Command\Repository\UpdateSettingsCommand;
23
use ApiClients\Client\Github\CommandBus\Command\WebHooksCommand;
24
use ApiClients\Client\Github\Resource\Repository as BaseRepository;
25
use React\Promise\PromiseInterface;
26
use React\Stream\ReadableStreamInterface;
27
use Rx\Observable;
28
use Rx\ObservableInterface;
29
use function ApiClients\Tools\Rx\unwrapObservableFromPromise;
30
31
class Repository extends BaseRepository
32
{
33
    public function refresh(): PromiseInterface
34
    {
35
        return $this->handleCommand(
36
            new RefreshCommand($this)
37
        );
38
    }
39
40
    public function branches(): ObservableInterface
41
    {
42
        return unwrapObservableFromPromise($this->handleCommand(
43
            new BranchesCommand($this->fullName())
44
        ));
45
    }
46
47
    public function commits(): ObservableInterface
48
    {
49
        return unwrapObservableFromPromise($this->handleCommand(
50
            new CommitsCommand($this->fullName())
51
        ));
52
    }
53
54
    public function labels(): ObservableInterface
55
    {
56
        return unwrapObservableFromPromise($this->handleCommand(
57
            new LabelsCommand($this->fullName())
58
        ));
59
    }
60
61
    public function addLabel(string $name, string $colour): PromiseInterface
62
    {
63
        return $this->handleCommand(
64
            new AddLabelCommand($this->fullName(), $name, $colour)
65
        );
66
    }
67
68
    public function contents(string $path = '/'): Observable
69
    {
70
        return unwrapObservableFromPromise(
71
            $this->handleCommand(
72
                new ContentsCommand($this->fullName(), $path)
73
            )
74
        );
75
    }
76
77
    public function communityHealth(): PromiseInterface
78
    {
79
        return $this->handleCommand(
80
            new CommunityHealthCommand($this->fullName())
81
        );
82
    }
83
84
    public function tags(): ObservableInterface
85
    {
86
        return unwrapObservableFromPromise($this->handleCommand(
87
            new TagsCommand($this->fullName())
88
        ));
89
    }
90
91
    public function releases(): ObservableInterface
92
    {
93
        return unwrapObservableFromPromise($this->handleCommand(
94
            new ReleasesCommand($this->fullName())
95
        ));
96
    }
97
98
    public function languages(): PromiseInterface
99
    {
100
        return $this->handleCommand(
101
            new LanguagesCommand($this->fullName())
102
        );
103
    }
104
105
    public function webHooks(): ObservableInterface
106
    {
107
        return unwrapObservableFromPromise($this->handleCommand(
108
            new WebHooksCommand($this->fullName(), 'repos')
109
        ));
110
    }
111
112
    public function addFile(
113
        string $filename,
114
        ReadableStreamInterface $stream,
115
        string $commitMessage = '',
116
        string $branch = ''
117
    ): PromiseInterface {
118
        if ($commitMessage === '') {
119
            $commitMessage = 'Update ' . $this->name;
120
        }
121
122
        return $this->handleCommand(new FileUploadCommand(
123
            $this->full_name,
124
            $commitMessage,
125
            '/repos/' . $this->full_name . '/contents/' . $filename,
126
            '',
127
            $branch,
128
            $stream
129
        ));
130
    }
131
132
    public function subscribe(bool $subscribed = true, bool $ignored = false): PromiseInterface
133
    {
134
        return $this->handleCommand(
135
            new SubscribeCommand($this->fullName(), $subscribed, $ignored)
136
        );
137
    }
138
139
    public function unSubscribe(): PromiseInterface
140
    {
141
        return $this->handleCommand(
142
            new UnSubscribeCommand($this->fullName())
143
        );
144
    }
145
146
    public function replaceTopics(string ...$topics): PromiseInterface
147
    {
148
        return $this->handleCommand(
149
            new ReplaceTopicsCommand($this->fullName(), ...$topics)
150
        );
151
    }
152
153
    public function travisRepository(): PromiseInterface
154
    {
155
        return $this->handleCommand(new TravisCommand($this->fullName()));
156
    }
157
158
    public function appVeyorRepository(): PromiseInterface
159
    {
160
        return $this->handleCommand(new AppVeyorCommand($this->fullName()));
161
    }
162
163
    public function scrutinizerRepository(): PromiseInterface
164
    {
165
        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...
166
    }
167
168
    public function updateSettings(array $settings): PromiseInterface
169
    {
170
        if (!isset($settings['name'])) {
171
            $settings['name'] = $this->name();
172
        }
173
174
        return $this->handleCommand(new UpdateSettingsCommand($this->fullName(), $settings));
175
    }
176
}
177