Passed
Push — master ( 4158cc...85b774 )
by Nico
17:22 queued 07:50
created

ActivateShields::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Module\Ship\Action\ActivateShields;
6
7
use request;
8
use Stu\Component\Ship\System\ShipSystemTypeEnum;
9
use Stu\Module\Control\ActionControllerInterface;
10
use Stu\Module\Control\GameControllerInterface;
11
use Stu\Module\Ship\Lib\ActivatorDeactivatorHelperInterface;
12
use Stu\Module\Ship\View\ShowShip\ShowShip;
13
14
final class ActivateShields implements ActionControllerInterface
15
{
16
    public const ACTION_IDENTIFIER = 'B_ACTIVATE_SHIELDS';
17
18
    private ActivatorDeactivatorHelperInterface $helper;
19
20 1
    public function __construct(
21
        ActivatorDeactivatorHelperInterface $helper
22
    ) {
23 1
        $this->helper = $helper;
24
    }
25
26 1
    public function handle(GameControllerInterface $game): void
27
    {
28 1
        $game->setView(ShowShip::VIEW_IDENTIFIER);
29
30 1
        $this->helper->activate(request::indInt('id'), ShipSystemTypeEnum::SYSTEM_SHIELDS, $game);
31
    }
32
33
    public function performSessionCheck(): bool
34
    {
35
        return true;
36
    }
37
}
38