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.

RequestService   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 36
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A request() 0 15 3
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Foundation\Transport\Service;
4
5
use ApiClients\Foundation\Transport\ClientInterface;
6
use ApiClients\Foundation\Transport\Middleware\BufferedSinkMiddleware;
7
use ApiClients\Foundation\Transport\Options;
8
use Psr\Http\Message\RequestInterface;
9
use React\Promise\CancellablePromiseInterface;
10
11
class RequestService
12
{
13
    /**
14
     * @var ClientInterface
15
     */
16
    private $client;
17
18
    /**
19
     * @param ClientInterface $client
20
     */
21 1
    public function __construct(ClientInterface $client)
22
    {
23 1
        $this->client = $client;
24 1
    }
25
26
    /**
27
     * @param  RequestInterface            $request
28
     * @param  array                       $options
29
     * @return CancellablePromiseInterface
30
     */
31 1
    public function request(RequestInterface $request, array $options = []): CancellablePromiseInterface
32
    {
33 1
        if (!isset($options[Options::MIDDLEWARE])) {
34 1
            $options[Options::MIDDLEWARE] = [];
35
        }
36
37 1
        if (!in_array(BufferedSinkMiddleware::class, $options[Options::MIDDLEWARE], true)) {
38 1
            $options[Options::MIDDLEWARE][] = BufferedSinkMiddleware::class;
39
        }
40
41 1
        return $this->client->request(
42 1
            $request,
43 1
            $options
44
        );
45
    }
46
}
47