Passed
Pull Request — master (#1779)
by Nico
49:51 queued 23:55
created

ChangeAlertStateToRed::action()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
nc 2
nop 2
dl 0
loc 6
ccs 0
cts 4
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\PirateReactionInterface;
7
use Stu\Module\Ship\Lib\FleetWrapperInterface;
8
9
class ChangeAlertStateToRed implements PirateBehaviourInterface
10
{
11
    public function action(FleetWrapperInterface $fleet, PirateReactionInterface $pirateReaction): void
12
    {
13
        $fleet = $fleet->get();
14
15
        foreach ($fleet->getShips() as $ship) {
16
            $ship->setAlertState(ShipAlertStateEnum::ALERT_RED);
17
        }
18
    }
19
}
20