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.

Code Duplication    Length = 44-49 lines in 2 locations

src/BuildMatrix.php 1 location

@@ 11-59 (lines=49) @@
8
use React\Promise\CancellablePromiseInterface;
9
use React\Promise\ExtendedPromiseInterface;
10
11
class BuildMatrix implements Iterator, ExtendedPromiseInterface, CancellablePromiseInterface, EndpointInterface
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

src/Builds.php 1 location

@@ 11-54 (lines=44) @@
8
use React\Promise\CancellablePromiseInterface;
9
use React\Promise\ExtendedPromiseInterface;
10
11
class Builds implements Iterator, ExtendedPromiseInterface, CancellablePromiseInterface, EndpointInterface
12
{
13
    use IteratorTrait;
14
    use LazyPromiseTrait;
15
    use ParentHasClientAwareTrait;
16
17
    /**
18
     * @var Repository
19
     */
20
    protected $repository;
21
22
    public function __construct(Repository $repository)
23
    {
24
        $this->setFactory(function () {
25
            return $this->getClient()->requestAsync($this);
26
        });
27
        $this->setParent($repository);
28
        $this->repository = $repository;
29
    }
30
31
    public function getRequest(): RequestInterface
32
    {
33
        return $this->parent->getClient()->createRequest(
34
            'GET',
35
            'repos/' . $this->repository->getRepository() . '/builds'
36
        );
37
    }
38
39
    public function fromResponse(ResponseInterface $response): EndpointInterface
40
    {
41
        $json = json_decode($response->getBody()->getContents());
42
        $builds = $this->createBuilds($json);
43
        return new BuildCollection($this->repository, $builds);
44
    }
45
46
    protected function createBuilds($json)
47
    {
48
        $builds = [];
49
        foreach ($json->builds as $build) {
50
            $builds[] = new Build($this->repository, $build);
51
        }
52
        return $builds;
53
    }
54
}
55