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

DeactivateTranswarpConsequence::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Module\Ship\Lib\Movement\Component\Consequence\PostFlight;
6
7
use Stu\Component\Ship\System\ShipSystemManagerInterface;
8
use Stu\Component\Ship\System\ShipSystemTypeEnum;
9
use Stu\Module\Ship\Lib\Message\MessageCollectionInterface;
10
use Stu\Module\Ship\Lib\Movement\Component\Consequence\AbstractFlightConsequence;
11
use Stu\Module\Ship\Lib\Movement\Route\FlightRouteInterface;
12
use Stu\Module\Ship\Lib\Movement\Route\RouteModeEnum;
13
use Stu\Module\Ship\Lib\ShipWrapperInterface;
14
15
class DeactivateTranswarpConsequence extends AbstractFlightConsequence
16
{
17
    private ShipSystemManagerInterface $shipSystemManager;
18
19 5
    public function __construct(
20
        ShipSystemManagerInterface $shipSystemManager
21
    ) {
22 5
        $this->shipSystemManager = $shipSystemManager;
23
    }
24
25 3
    protected function triggerSpecific(
26
        ShipWrapperInterface $wrapper,
27
        FlightRouteInterface $flightRoute,
28
        MessageCollectionInterface $messages
29
    ): void {
30 3
        if ($wrapper->get()->isTractored()) {
31 1
            return;
32
        }
33
34 2
        if ($flightRoute->getRouteMode() === RouteModeEnum::ROUTE_MODE_TRANSWARP) {
35 1
            $this->shipSystemManager->deactivate($wrapper, ShipSystemTypeEnum::SYSTEM_TRANSWARP_COIL, true);
36
        }
37
    }
38
}
39