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 ( 3abaaf...dcd0c7 )
by Cees-Jan
8s
created

AsyncClient   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 0%
Metric Value
wmc 3
lcom 1
cbo 4
dl 0
loc 21
ccs 0
cts 15
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
A repository() 0 6 1
1
<?php
2
declare(strict_types=1);
3
4
namespace WyriHaximus\Travis;
5
6
use React\EventLoop\LoopInterface;
7
use React\Promise\PromiseInterface;
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(LoopInterface $loop, Transport $transport = null)
17
    {
18
        if (!($transport instanceof Transport)) {
19
            $transport = Factory::create($loop, [
20
                'resource_namespace' => 'Async',
21
            ]);
22
        }
23
        $this->transport = $transport;
24
    }
25
26
    public function repository(string $repository): PromiseInterface
27
    {
28
        return $this->transport->request('repos/' . $repository)->then(function ($json) {
29
            return resolve($this->transport->getHydrator()->hydrate('Repository', $json['repo']));
30
        });
31
    }
32
}
33