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

CrewCondition   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 15
ccs 8
cts 8
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A check() 0 13 2
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