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.

Tests   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 7
eloc 34
c 2
b 0
f 1
dl 0
loc 54
ccs 30
cts 30
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
B __invoke() 0 45 6
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\LabStation\Trigger;
5
6
use Innmind\LabStation\{
7
    Trigger,
8
    Activity,
9
    Activity\Type,
10
};
11
use Innmind\CLI\Environment;
12
use Innmind\Server\Control\Server\{
13
    Processes,
14
    Command,
15
    Process\Output,
16
};
17
use Innmind\Immutable\Str;
18
19
final class Tests implements Trigger
20
{
21
    private $processes;
22
23 14
    public function __construct(Processes $processes)
24
    {
25 14
        $this->processes = $processes;
26 14
    }
27
28 10
    public function __invoke(Activity $activity, Environment $env): void
29
    {
30
        if (
31 10
            !$activity->is(Type::sourcesModified()) &&
32 10
            !$activity->is(Type::testsModified())
33
        ) {
34 2
            return;
35
        }
36
37 8
        $output = $env->output();
38 8
        $error = $env->error();
39
40
        $process = $this
41 8
            ->processes
42 8
            ->execute(
43 8
                Command::foreground('vendor/bin/phpunit')
44 8
                    ->withOption('colors', 'always')
45 8
                    ->withWorkingDirectory((string) $env->workingDirectory())
46
            );
47
        $process
48 8
            ->output()
49
            ->foreach(static function(Str $line, Output\Type $type) use ($output, $error): void {
50 4
                if ($type === Output\Type::output()) {
51 4
                    $output->write($line);
52
                } else {
53 4
                    $error->write($line);
54
                }
55 8
            });
56 8
        $process->wait();
57
58 8
        if ($env->arguments()->contains('--silent')) {
59 2
            return;
60
        }
61
62 6
        $successful = $process->exitCode()->isSuccessful();
63 6
        $text = 'PHPUnit : ';
64 6
        $text .= $successful ? 'ok' : 'failing';
65
66
        $this
67 6
            ->processes
68 6
            ->execute(
69 6
                Command::foreground('say')
70 6
                    ->withArgument($text)
71
            )
72 6
            ->wait();
73 6
    }
74
}
75