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
08:04
created

Factory::create()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 19
Code Lines 9

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 19
rs 9.4285
cc 2
eloc 9
nc 2
nop 1
1
<?php
2
declare(strict_types=1);
3
4
namespace WyriHaximus\Travis\Transport;
5
6
use Aws\Handler\GuzzleV6\GuzzleHandler;
7
use GuzzleHttp\Client as GuzzleClient;
8
use GuzzleHttp\HandlerStack;
9
use React\EventLoop\Factory as LoopFactory;
10
use React\EventLoop\LoopInterface;
11
use WyriHaximus\React\GuzzlePsr7\HttpClientAdapter;
12
13
class Factory
14
{
15
    public static function create(LoopInterface $loop = null): Client
16
    {
17
        if (!($loop instanceof LoopInterface)) {
18
            $loop = LoopFactory::create();
19
        }
20
21
        return new Client(
22
            $loop,
23
            new GuzzleHandler(
24
                new GuzzleClient(
25
                    [
26
                        'handler' => HandlerStack::create(
27
                            new HttpClientAdapter($loop)
28
                        ),
29
                    ]
30
                )
31
            )
32
        );
33
    }
34
}
35