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

WatchTests   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 16
dl 0
loc 31
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A __invoke() 0 12 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\LabStation\Agent;
5
6
use Innmind\LabStation\{
7
    Agent,
8
    Protocol,
9
    Activity,
10
    Activity\Type,
11
};
12
use Innmind\FileWatch\Watch;
13
use Innmind\IPC\{
14
    IPC,
15
    Process\Name,
16
};
17
use Innmind\Url\{
18
    PathInterface,
19
    Path,
20
};
21
22
final class WatchTests implements Agent
23
{
24
    private $protocol;
25
    private $watch;
26
    private $ipc;
27
    private $monitor;
28
29 4
    public function __construct(
30
        Protocol $protocol,
31
        Watch $watch,
32
        IPC $ipc,
33
        Name $monitor
34
    ) {
35 4
        $this->protocol = $protocol;
36 4
        $this->watch = $watch;
37 4
        $this->ipc = $ipc;
38 4
        $this->monitor = $monitor;
39 4
    }
40
41 2
    public function __invoke(PathInterface $project): void
42
    {
43 2
        $tests = new Path($project.'/tests');
44
45
        ($this->watch)($tests)(function() {
46 2
            $monitor = $this->ipc->get($this->monitor);
47 2
            $monitor->send(
48 2
                $this->protocol->encode(
49 2
                    new Activity(Type::testsModified(), [])
50
                )
51
            );
52 2
            $monitor->close();
53 2
        });
54 2
    }
55
}
56