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

ActivateShields   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 71.43%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 22
ccs 5
cts 7
cp 0.7143
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A performSessionCheck() 0 3 1
A __construct() 0 4 1
A handle() 0 5 1
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