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 ( 28fbd7...75c995 )
by Cees-Jan
06:12
created

RequestService::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Foundation\Transport\Service;
4
5
use ApiClients\Foundation\Service\ServiceInterface;
6
use ApiClients\Foundation\Transport\ClientInterface;
7
use ApiClients\Foundation\Transport\Middleware\BufferedSinkMiddleware;
8
use ApiClients\Foundation\Transport\Options;
9
use Psr\Http\Message\RequestInterface;
10
use React\Promise\CancellablePromiseInterface;
11
use function React\Promise\resolve;
12
13
class RequestService
14
{
15
    /**
16
     * @var ClientInterface
17
     */
18
    private $client;
19
20
    /**
21
     * @param ClientInterface $client
22
     */
23 1
    public function __construct(ClientInterface $client)
24
    {
25 1
        $this->client = $client;
26 1
    }
27
28
    /**
29
     * @param RequestInterface $request
30
     * @param array $options
31
     * @return CancellablePromiseInterface
32
     */
33 1
    public function request(RequestInterface $request, array $options = []): CancellablePromiseInterface
34
    {
35 1
        if (!isset($options[Options::MIDDLEWARE])) {
36 1
            $options[Options::MIDDLEWARE] = [];
37
        }
38
39 1
        if (!in_array(BufferedSinkMiddleware::class, $options[Options::MIDDLEWARE])) {
40 1
            $options[Options::MIDDLEWARE][] = BufferedSinkMiddleware::class;
41
        }
42
43 1
        return $this->client->request(
44
            $request,
45 1
            $options
46
        );
47
    }
48
}
49