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 ( 71a4f9...212da1 )
by Cees-Jan
06:21
created

Builds   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 8
Metric Value
wmc 6
lcom 1
cbo 8
dl 0
loc 41
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getRequest() 0 4 1
A fromResponse() 0 6 1
A createBuilds() 0 8 2
A matrix() 0 4 1
1
<?php
2
3
namespace WyriHaximus\Travis;
4
5
use Psr\Http\Message\RequestInterface;
6
use Psr\Http\Message\ResponseInterface;
7
8
class Builds implements EndpointInterface
9
{
10
    use ParentHasClientAwareTrait;
11
12
    /**
13
     * @var Repository
14
     */
15
    protected $repository;
16
17
    public function __construct(Repository $repository)
18
    {
19
        $this->setParent($repository);
20
        $this->repository = $repository;
21
    }
22
23
    public function getRequest(): RequestInterface
24
    {
25
        return $this->parent->getClient()->createRequert('GET', 'repos/' . $this->repository->getRepository() . '/builds');
26
    }
27
28
    public function fromResponse(ResponseInterface $response): EndpointInterface
29
    {
30
        $json = json_decode($response->getBody()->getContents());
31
        $builds = $this->createBuilds($json);
32
        return new BuildCollection($this->repository, $builds);
33
    }
34
35
    protected function createBuilds($json)
36
    {
37
        $builds = [];
38
        foreach ($json->builds as $build) {
39
            $builds[] = new Build($this->repository, $build);
40
        }
41
        return $builds;
42
    }
43
44
    public function matrix()
45
    {
46
47
    }
48
}
49