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
09:45
created

AsyncClient   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 19
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
A repository() 0 6 1
1
<?php
2
declare(strict_types=1);
3
4
namespace WyriHaximus\Travis;
5
6
use React\Promise\PromiseInterface;
7
use WyriHaximus\Travis\Resource\Async\Repository;
8
use WyriHaximus\Travis\Transport\Client as Transport;
9
use WyriHaximus\Travis\Transport\Factory;
10
use function React\Promise\resolve;
11
12
class AsyncClient
13
{
14
    protected $transport;
15
16
    public function __construct(Transport $transport = null)
17
    {
18
        if (!($transport instanceof Transport)) {
19
            $transport = Factory::create();
20
        }
21
        $this->transport = $transport;
22
    }
23
24
    public function repository(string $repository): PromiseInterface
25
    {
26
        return $this->transport->request('repos/' . $repository)->then(function ($json) {
27
            return resolve($this->transport->hydrate(Repository::class, $json['repo']));
28
        });
29
    }
30
}
31