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 (#18)
by Cees-Jan
02:04
created

Repository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Test Coverage

Coverage 0%
Metric Value
wmc 2
lcom 1
cbo 6
dl 0
loc 22
ccs 0
cts 16
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A builds() 0 10 1
A build() 0 8 1
1
<?php
2
declare(strict_types=1);
3
4
namespace WyriHaximus\Travis\Resource\Async;
5
6
use React\Promise\PromiseInterface;
7
use Rx\Observable;
8
use Rx\ObservableInterface;
9
use Rx\React\Promise;
10
use WyriHaximus\Travis\Resource\Repository as BaseRepository;
11
use function React\Promise\resolve;
12
13
class Repository extends BaseRepository
14
{
15
    public function builds(): ObservableInterface
16
    {
17
        return Promise::toObservable(
18
            $this->getTransport()->request('repos/' . $this->slug() . '/builds')
19
        )->flatMap(function ($response) {
20
            return Observable::fromArray($response['builds']);
21
        })->map(function ($build) {
22
            return $this->getTransport()->hydrate('Build', $build);
23
        });
24
    }
25
26
    public function build(int $id): PromiseInterface
27
    {
28
        return $this->getTransport()->request(
29
            'repos/' . $this->slug() . '/builds/' . $id
30
        )->then(function ($response) {
31
            return resolve($this->getTransport()->hydrate('Build', $response['build']));
32
        });
33
    }
34
}
35