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

Client::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 2
Bugs 1 Features 0
Metric Value
dl 0
loc 10
ccs 0
cts 10
cp 0
rs 9.4285
c 2
b 1
f 0
cc 2
eloc 6
nc 2
nop 1
crap 6
1
<?php
2
declare(strict_types=1);
3
4
namespace WyriHaximus\Travis;
5
6
use WyriHaximus\Travis\Resource\Sync\Repository;
7
use WyriHaximus\Travis\Transport\Client as Transport;
8
use WyriHaximus\Travis\Transport\Factory;
9
use function Clue\React\Block\await;
10
use function React\Promise\resolve;
11
12
class Client
13
{
14
    protected $transport;
15
    protected $client;
16
17
    public function __construct(Transport $transport = null)
18
    {
19
        if (!($transport instanceof Transport)) {
20
            $transport = Factory::create(null, [
21
                'resource_namespace' => 'Sync',
22
            ]);
23
        }
24
        $this->transport = $transport;
25
        $this->client = new AsyncClient($this->transport);
26
    }
27
28
    public function repository(string $repository): Repository
29
    {
30
        return await(
31
            $this->client->repository($repository),
32
            $this->transport->getLoop()
33
        );
34
    }
35
}
36