Passed
Push — dev ( 220852...a22d66 )
by Janko
21:21
created

ChangeAlertStateToRed::action()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
nc 2
nop 2
dl 0
loc 9
ccs 0
cts 5
cp 0
crap 6
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Stu\Lib\Pirate\Behaviour;
4
5
use Stu\Component\Ship\ShipAlertStateEnum;
6
use Stu\Lib\Pirate\PirateBehaviourEnum;
7
use Stu\Lib\Pirate\PirateReactionInterface;
8
use Stu\Module\Ship\Lib\FleetWrapperInterface;
9
10
class ChangeAlertStateToRed implements PirateBehaviourInterface
11
{
12
    public function action(FleetWrapperInterface $fleet, PirateReactionInterface $pirateReaction): ?PirateBehaviourEnum
13
    {
14
        $fleet = $fleet->get();
15
16
        foreach ($fleet->getShips() as $ship) {
17
            $ship->setAlertState(ShipAlertStateEnum::ALERT_RED);
18
        }
19
20
        return null;
21
    }
22
}
23