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 ( 36e639...e2a32c )
by Cees-Jan
07:31 queued 04:17
created

RequestService::request()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 15
ccs 0
cts 6
cp 0
rs 9.4285
cc 3
eloc 8
nc 4
nop 2
crap 12
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
    public function __construct(ClientInterface $client)
24
    {
25
        $this->client = $client;
26
    }
27
28
    /**
29
     * @param RequestInterface $request
30
     * @param array $options
31
     * @return CancellablePromiseInterface
32
     */
33
    public function request(RequestInterface $request, array $options = []): CancellablePromiseInterface
34
    {
35
        if (!isset($options[Options::MIDDLEWARE])) {
36
            $options[Options::MIDDLEWARE] = [];
37
        }
38
39
        if (!in_array(BufferedSinkMiddleware::class, $options[Options::MIDDLEWARE])) {
40
            $options[Options::MIDDLEWARE][] = BufferedSinkMiddleware::class;
41
        }
42
43
        return $this->client->request(
44
            $request,
45
            $options
46
        );
47
    }
48
}
49