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 (#29)
by Cees-Jan
07:13
created

Repository   B

Complexity

Total Complexity 18

Size/Duplication

Total Lines 130
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 18

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 18
lcom 1
cbo 18
dl 0
loc 130
rs 7.3333
c 0
b 0
f 0
ccs 0
cts 46
cp 0

17 Methods

Rating   Name   Duplication   Size   Complexity  
A refresh() 0 6 1
A branches() 0 6 1
A commits() 0 6 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 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
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\Resource\Repository as BaseRepository;
23
use React\Promise\PromiseInterface;
24
use React\Stream\ReadableStreamInterface;
25
use Rx\Observable;
26
use Rx\ObservableInterface;
27
use function ApiClients\Tools\Rx\unwrapObservableFromPromise;
28
29
class Repository extends BaseRepository
30
{
31
    public function refresh(): PromiseInterface
32
    {
33
        return $this->handleCommand(
34
            new RefreshCommand($this)
35
        );
36
    }
37
38
    public function branches(): ObservableInterface
39
    {
40
        return unwrapObservableFromPromise($this->handleCommand(
41
            new BranchesCommand($this->fullName())
42
        ));
43
    }
44
45
    public function commits(): ObservableInterface
46
    {
47
        return unwrapObservableFromPromise($this->handleCommand(
48
            new CommitsCommand($this->fullName())
49
        ));
50
    }
51
52
    public function labels(): ObservableInterface
53
    {
54
        return unwrapObservableFromPromise($this->handleCommand(
55
            new LabelsCommand($this->fullName())
56
        ));
57
    }
58
59
    public function addLabel(string $name, string $colour): PromiseInterface
60
    {
61
        return $this->handleCommand(
62
            new AddLabelCommand($this->fullName(), $name, $colour)
63
        );
64
    }
65
66
    public function contents(string $path = '/'): Observable
67
    {
68
        return unwrapObservableFromPromise(
69
            $this->handleCommand(
70
                new ContentsCommand($this->fullName(), $path)
71
            )
72
        );
73
    }
74
75
    public function communityHealth(): PromiseInterface
76
    {
77
        return $this->handleCommand(
78
            new CommunityHealthCommand($this->fullName())
79
        );
80
    }
81
82
    public function tags(): ObservableInterface
83
    {
84
        return unwrapObservableFromPromise($this->handleCommand(
85
            new TagsCommand($this->fullName())
86
        ));
87
    }
88
89
    public function releases(): ObservableInterface
90
    {
91
        return unwrapObservableFromPromise($this->handleCommand(
92
            new ReleasesCommand($this->fullName())
93
        ));
94
    }
95
96
    public function languages(): PromiseInterface
97
    {
98
        return $this->handleCommand(
99
            new LanguagesCommand($this->fullName())
100
        );
101
    }
102
103
    public function addFile(
104
        string $filename,
105
        ReadableStreamInterface $stream,
106
        string $commitMessage = '',
107
        string $branch = ''
108
    ): PromiseInterface {
109
        if ($commitMessage === '') {
110
            $commitMessage = 'Update ' . $this->name;
111
        }
112
113
        return $this->handleCommand(new FileUploadCommand(
114
            $this->full_name,
115
            $commitMessage,
116
            '/repos/' . $this->full_name . '/contents/' . $filename,
117
            '',
118
            $branch,
119
            $stream
120
        ));
121
    }
122
123
    public function subscribe(bool $subscribed = true, bool $ignored = false): PromiseInterface
124
    {
125
        return $this->handleCommand(
126
            new SubscribeCommand($this->fullName(), $subscribed, $ignored)
127
        );
128
    }
129
130
    public function unSubscribe(): PromiseInterface
131
    {
132
        return $this->handleCommand(
133
            new UnSubscribeCommand($this->fullName())
134
        );
135
    }
136
137
    public function replaceTopics(string ...$topics): PromiseInterface
138
    {
139
        return $this->handleCommand(
140
            new ReplaceTopicsCommand($this->fullName(), ...$topics)
141
        );
142
    }
143
144
    public function travisRepository(): PromiseInterface
145
    {
146
        return $this->handleCommand(new TravisCommand($this->fullName()));
147
    }
148
149
    public function appVeyorRepository(): PromiseInterface
150
    {
151
        return $this->handleCommand(new AppVeyorCommand($this->fullName()));
152
    }
153
154
    public function scrutinizerRepository(): PromiseInterface
155
    {
156
        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...
157
    }
158
}
159