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.

QueueCaller   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 91.3%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 44
ccs 21
cts 23
cp 0.913
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A call() 0 28 3
1
<?php declare(strict_types=1);
2
3
namespace WyriHaximus\Recoil;
4
5
use Recoil\Kernel;
6
use Rx\ObservableInterface;
7
use function WyriHaximus\Rx\observableWhile;
8
9
final class QueueCaller implements QueueCallerInterface
10
{
11
    /**
12
     * @var Kernel
13
     */
14
    private $kernel;
15
16
    /**
17
     * @param Kernel $kernel
18
     */
19 1
    public function __construct(Kernel $kernel)
20
    {
21 1
        $this->kernel = $kernel;
22 1
    }
23
24 1
    public function call(ObservableInterface $observable): State
25
    {
26 1
        $state = new State();
27
        $this->kernel->execute(function () use ($observable, $state) {
28 1
            $state->onNext(State::STARTED);
29 1
            yield;
30 1
            $observableWhile = observableWhile($observable);
31 1
            $state->onNext(State::WAITING);
32
            /** @var Call $call */
33 1
            while ($call = (yield $observableWhile->get())) {
34
                try {
35 1
                    $state->onNext(State::BUSY);
36 1
                    $callable = $call->getCallable();
37 1
                    $arguments = $call->getArguments();
38 1
                    $value = yield $callable(...$arguments);
39 1
                    $call->resolve($value);
40
                } catch (\Throwable $et) {
41
                    $call->reject($et);
42 1
                } finally {
43 1
                    unset($callable, $arguments, $call);
44 1
                    $state->onNext(State::WAITING);
45
                }
46
            }
47 1
            $state->onNext(State::DONE);
48 1
        });
49
50 1
        return $state;
51
    }
52
}
53