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.
Passed
Push — develop ( 7bdedc...1fa222 )
by Baptiste
02:15
created

DockerCompose::__invoke()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 17
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 3

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 17
ccs 11
cts 11
cp 1
rs 9.9332
c 0
b 0
f 0
cc 3
nc 3
nop 2
crap 3
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\OperatingSystem\Filesystem;
13
use Innmind\Server\Control\Server\{
14
    Processes,
15
    Command,
16
};
17
18
final class DockerCompose implements Trigger
19
{
20
    private $filesystem;
21
    private $processes;
22
23 10
    public function __construct(Filesystem $filesystem, Processes $processes)
24
    {
25 10
        $this->filesystem = $filesystem;
26 10
        $this->processes = $processes;
27 10
    }
28
29 6
    public function __invoke(Activity $activity, Environment $env): void
30
    {
31 6
        if (!$activity->is(Type::start())) {
32 2
            return;
33
        }
34
35 4
        $project = $this->filesystem->mount($env->workingDirectory());
36
37 4
        if (!$project->has('docker-compose.yml')) {
38 2
            return;
39
        }
40
41 2
        $this->processes->execute(
42 2
            Command::foreground('docker-compose')
43 2
                ->withArgument('up')
44 2
                ->withShortOption('d')
45 2
                ->withWorkingDirectory((string) $env->workingDirectory())
46
        );
47 2
    }
48
}
49