Passed
Push — master ( 288b46...98b0e3 )
by Nico
31:30 queued 08:00
created

CrewCondition::check()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 7
c 1
b 0
f 0
nc 2
nop 3
dl 0
loc 13
ccs 8
cts 8
cp 1
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Module\Ship\Lib\Movement\Component\PreFlight\Condition;
6
7
use Stu\Module\Ship\Lib\Movement\Component\PreFlight\ConditionCheckResult;
8
use Stu\Module\Ship\Lib\Movement\Route\FlightRouteInterface;
9
use Stu\Module\Ship\Lib\ShipWrapperInterface;
10
11
class CrewCondition implements PreFlightConditionInterface
12
{
13 2
    public function check(
14
        ShipWrapperInterface $wrapper,
15
        FlightRouteInterface $flightRoute,
16
        ConditionCheckResult $conditionCheckResult
17
    ): void {
18 2
        $ship = $wrapper->get();
19
20 2
        if (!$ship->hasEnoughCrew()) {
21 1
            $conditionCheckResult->addBlockedShip(
22 1
                $ship,
23 1
                sprintf(
24 1
                    'Die %s hat ungenügend Crew',
25 1
                    $ship->getName()
26 1
                )
27 1
            );
28
        }
29
    }
30
}
31