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 — develop ( 8a6344...962010 )
by Baptiste
02:40
created

Monitor::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 23
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 23
ccs 14
cts 14
cp 1
rs 9.8333
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\LabStation;
5
6
use Innmind\LabStation\Activity\Type;
7
use Innmind\ProcessManager\Manager;
8
use Innmind\IPC\{
9
    IPC,
10
    Message,
11
    Process\Name,
12
};
13
use Innmind\CLI\Environment;
14
15
final class Monitor
16
{
17
    private $protocol;
18
    private $manager;
19
    private $ipc;
20
    private $name;
21
    private $trigger;
22
    private $agents;
23
24 2
    public function __construct(
25
        Protocol $protocol,
26
        Manager $manager,
27
        IPC $ipc,
28
        Name $name,
29
        Trigger $trigger,
30
        Agent ...$agents
31
    ) {
32 2
        $this->protocol = $protocol;
33 2
        $this->manager = $manager;
34 2
        $this->ipc = $ipc;
35 2
        $this->name = $name;
36 2
        $this->trigger = $trigger;
37 2
        $this->agents = $agents;
38 2
    }
39
40 2
    public function __invoke(Environment $env): void
41
    {
42 2
        $project = $env->workingDirectory();
43 2
        $agents = $this->manager;
44
45 2
        foreach ($this->agents as $agent) {
46
            $agents = $agents->schedule(static function() use ($agent, $project): void {
47 2
                $agent($project);
48 2
            });
49
        }
50
51 2
        $agents = $agents();
52 2
        ($this->trigger)(
53 2
            new Activity(Type::start(), []),
54 1
            $env
55
        );
56
57
        $this->ipc->listen($this->name)(function(Message $message) use ($env): void {
58 2
            $activity = $this->protocol->decode($message);
59 2
            ($this->trigger)($activity, $env);
60 2
        });
61
62 2
        $agents->kill();
63 2
    }
64
}
65