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.

AbstractResource::handleCommand()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Foundation\Resource;
4
5
use ApiClients\Tools\CommandBus\CommandBusInterface;
6
use function Clue\React\Block\await;
7
use React\EventLoop\LoopInterface;
8
use React\Promise\CancellablePromiseInterface;
9
use React\Promise\PromiseInterface;
10
11
abstract class AbstractResource implements ResourceInterface
12
{
13
    /**
14
     * @var LoopInterface
15
     */
16
    private $loop;
17
18
    /**
19
     * @var CommandBusInterface
20
     */
21
    private $commandBus;
22
23 5
    public function __construct(LoopInterface $loop, CommandBusInterface $commandBus)
24
    {
25 5
        $this->loop = $loop;
26 5
        $this->commandBus = $commandBus;
27 5
    }
28
29
    /**
30
     * @param $command
31
     * @return CancellablePromiseInterface
32
     */
33 1
    protected function handleCommand($command): CancellablePromiseInterface
34
    {
35 1
        return $this->commandBus->handle($command);
36
    }
37
38 1
    protected function wait(PromiseInterface $promise)
39
    {
40 1
        return await($promise, $this->loop);
41
    }
42
}
43