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 (#2)
by Cees-Jan
29:14 queued 19:05
created

StreamingRequestHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 4
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 9 1
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Foundation\Transport\CommandBus\Handler;
4
5
use ApiClients\Foundation\Transport\Client;
6
use ApiClients\Foundation\Transport\CommandBus\Command\RequestCommandInterface;
7
use ApiClients\Foundation\Transport\StreamingResponse;
8
use Psr\Http\Message\ResponseInterface;
9
use React\Promise\PromiseInterface;
10
use function React\Promise\resolve;
11
12
final class StreamingRequestHandler
13
{
14
    /**
15
     * @var Client
16
     */
17
    private $client;
18
19
    /**
20
     * @param Client $client
21
     */
22
    public function __construct(Client $client)
23
    {
24
        $this->client = $client;
25
    }
26
27
    public function handle(RequestCommandInterface $command): PromiseInterface
28
    {
29
        return $this->client->request(
30
            $command->getRequest(),
31
            $command->getOptions()
32
        )->then(function (ResponseInterface $response) {
33
            return resolve(new StreamingResponse($response));
34
        });
35
    }
36
}
37