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

AsyncClient::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6
Metric Value
dl 0
loc 9
ccs 0
cts 9
cp 0
rs 9.6666
cc 2
eloc 5
nc 2
nop 1
crap 6
1
<?php
2
declare(strict_types=1);
3
4
namespace WyriHaximus\Travis;
5
6
use React\Promise\PromiseInterface;
7
use WyriHaximus\Travis\Transport\Client as Transport;
8
use WyriHaximus\Travis\Transport\Factory;
9
use function React\Promise\resolve;
10
11
class AsyncClient
12
{
13
    protected $transport;
14
15
    public function __construct(Transport $transport = null)
16
    {
17
        if (!($transport instanceof Transport)) {
18
            $transport = Factory::create(null, [
19
                'resource_namespace' => 'Async',
20
            ]);
21
        }
22
        $this->transport = $transport;
23
    }
24
25
    public function repository(string $repository): PromiseInterface
26
    {
27
        return $this->transport->request('repos/' . $repository)->then(function ($json) {
28
            return resolve($this->transport->hydrate('Repository', $json['repo']));
29
        });
30
    }
31
}
32