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 (#10)
by Cees-Jan
02:02
created

AbstractResource   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Importance

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

3 Methods

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