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 ( 352f99...e3c5ff )
by Cees-Jan
09:24
created

BuildMatrix::getRequest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 7
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2
Metric Value
dl 7
loc 7
ccs 0
cts 0
cp 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
crap 2
1
<?php
2
3
namespace WyriHaximus\Travis;
4
5
use Iterator;
6
use Psr\Http\Message\RequestInterface;
7
use Psr\Http\Message\ResponseInterface;
8
use React\Promise\CancellablePromiseInterface;
9
use React\Promise\ExtendedPromiseInterface;
10
11 View Code Duplication
class BuildMatrix implements Iterator, ExtendedPromiseInterface, CancellablePromiseInterface, EndpointInterface
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...
12
{
13
    use IteratorTrait;
14
    use LazyPromiseTrait;
15
    use ParentHasClientAwareTrait;
16
17
    /**
18
     * @var Build
19
     */
20
    protected $build;
21
22
    public function __construct(Build $build)
23
    {
24
        $this->setFactory(function () {
25
            return $this->getClient()->requestAsync($this);
26
        });
27
        $this->setParent($build);
28
        $this->build = $build;
29
    }
30
31
    public function getRequest(): RequestInterface
32
    {
33
        return $this->parent->getClient()->createRequest(
34
            'GET',
35
            'builds/' . $this->build->getId()
36
        );
37
    }
38
39
    public function fromResponse(ResponseInterface $response): EndpointInterface
40
    {
41
        $json = json_decode($response->getBody()->getContents());
42
        $jobs = $this->createJobs($json);
43
        return new JobCollection($this->build, $jobs);
44
    }
45
46
    protected function createJobs($json)
47
    {
48
        $builds = [];
49
        foreach ($json->jobs as $build) {
50
            $builds[] = new Job($this->build, $build);
51
        }
52
        return $builds;
53
    }
54
55
    public function matrix()
56
    {
57
58
    }
59
}
60