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.

EnvironmentVariable::refresh()   A
last analyzed

Complexity

Conditions 3
Paths 1

Size

Total Lines 19
Code Lines 11

Duplication

Lines 19
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 2
Bugs 0 Features 0
Metric Value
dl 19
loc 19
rs 9.4285
c 2
b 0
f 0
ccs 0
cts 15
cp 0
cc 3
eloc 11
nc 1
nop 0
crap 12
1
<?php
2
declare(strict_types=1);
3
4
namespace WyriHaximus\Travis\Resource\Async;
5
6
use ApiClients\Foundation\Hydrator\CommandBus\Command\HydrateCommand;
7
use ApiClients\Foundation\Transport\CommandBus\Command\SimpleRequestCommand;
8
use React\Promise\PromiseInterface;
9
use WyriHaximus\Travis\Resource\EnvironmentVariable as BaseEnvironmentVariable;
10
use function React\Promise\reject;
11
use function React\Promise\resolve;
12
13 View Code Duplication
class EnvironmentVariable extends BaseEnvironmentVariable
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
{
15
    public function refresh() : PromiseInterface
16
    {
17
        return $this->handleCommand(new SimpleRequestCommand(
18
            'settings/env_vars?repository_id=' . $this->repositoryId()
19
        ))->then(function ($json) {
20
            foreach ($json['env_vars'] as $envVar) {
21
                if ($envVar['id'] != $this->id()) {
22
                    continue;
23
                }
24
25
                return resolve($this->handleCommand(new HydrateCommand(
26
                    'EnvironmentVariable',
27
                    $envVar
28
                )));
29
            }
30
31
            return reject();
32
        });
33
    }
34
}
35