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 ( 6ae441...2b5546 )
by Cees-Jan
15s queued 13s
created

StreamingRequestService   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 30
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A stream() 0 9 1
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\StreamingResponse;
7
use Psr\Http\Message\RequestInterface;
8
use Psr\Http\Message\ResponseInterface;
9
use React\Promise\CancellablePromiseInterface;
10
use function React\Promise\resolve;
11
12
class StreamingRequestService
13
{
14
    /**
15
     * @var ClientInterface
16
     */
17
    private $client;
18
19
    /**
20
     * @param ClientInterface $client
21
     */
22 1
    public function __construct(ClientInterface $client)
23
    {
24 1
        $this->client = $client;
25 1
    }
26
27
    /**
28
     * @param  RequestInterface            $request
29
     * @param  array                       $options
30
     * @return CancellablePromiseInterface
31
     */
32 1
    public function stream(RequestInterface $request, array $options = []): CancellablePromiseInterface
33
    {
34 1
        return $this->client->request(
35 1
            $request,
36 1
            $options
37 1
        )->then(function (ResponseInterface $response) {
38 1
            return resolve(new StreamingResponse($response));
39 1
        });
40
    }
41
}
42