Passed
Push — dev ( ee7c77...87c3fc )
by Janko
23:36
created

DeactivateShieldsBehaviour::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 2
ccs 0
cts 1
cp 0
crap 2
rs 10
1
<?php
2
3
namespace Stu\Lib\Pirate\Behaviour;
4
5
use Stu\Component\Ship\System\ShipSystemManagerInterface;
6
use Stu\Component\Ship\System\ShipSystemTypeEnum;
7
use Stu\Lib\Pirate\PirateBehaviourEnum;
8
use Stu\Lib\Pirate\PirateReactionInterface;
9
use Stu\Module\Ship\Lib\FleetWrapperInterface;
10
11
class DeactivateShieldsBehaviour implements PirateBehaviourInterface
12
{
13
    public function __construct(private ShipSystemManagerInterface $shipSystemManager)
14
    {
15
    }
16
    public function action(FleetWrapperInterface $fleetWrapper, PirateReactionInterface $pirateReaction): ?PirateBehaviourEnum
17
    {
18
        foreach ($fleetWrapper->getShipWrappers() as $wrapper) {
19
            $this->shipSystemManager->deactivate($wrapper, ShipSystemTypeEnum::SYSTEM_SHIELDS, true);
20
        }
21
22
        return null;
23
    }
24
}
25