Passed
Push — master ( 37217b...efdda9 )
by Nico
19:16 queued 09:28
created

GenerateEmptySystems::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 2
b 0
f 0
nc 1
nop 1
dl 0
loc 7
ccs 0
cts 4
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Module\Admin\Action\Map\GenerateEmptySystems;
6
7
use request;
8
use Stu\Component\StarSystem\GenerateEmptySystemsInterface;
9
use Stu\Module\Admin\View\Map\ShowMapEditor;
10
use Stu\Module\Control\ActionControllerInterface;
11
use Stu\Module\Control\GameControllerInterface;
12
13
final class GenerateEmptySystems implements ActionControllerInterface
14
{
15
    public const ACTION_IDENTIFIER = 'GENERATE_EMPTY_SYSTEMS';
16
17
    private GenerateEmptySystemsInterface $generateEmptySystems;
18
19
    public function __construct(
20
        GenerateEmptySystemsInterface $generateEmptySystems,
21
    ) {
22
        $this->generateEmptySystems = $generateEmptySystems;
23
    }
24
25
    public function handle(GameControllerInterface $game): void
26
    {
27
        $game->setView(ShowMapEditor::VIEW_IDENTIFIER);
28
29
        $count = $this->generateEmptySystems->generate(request::getInt('layerid'));
30
31
        $game->addInformation(sprintf('Es wurden %d Systeme generiert.', $count));
32
    }
33
34
    public function performSessionCheck(): bool
35
    {
36
        return false;
37
    }
38
}
39