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

PostFlightTractorConsequence   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 26
ccs 10
cts 10
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A triggerSpecific() 0 16 2
A __construct() 0 4 1
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\Utility\TractorMassPayloadUtilInterface;
8
use Stu\Module\Ship\Lib\Message\MessageCollectionInterface;
9
use Stu\Module\Ship\Lib\Movement\Component\Consequence\AbstractFlightConsequence;
10
use Stu\Module\Ship\Lib\Movement\Route\FlightRouteInterface;
11
use Stu\Module\Ship\Lib\ShipWrapperInterface;
12
13
class PostFlightTractorConsequence extends AbstractFlightConsequence
14
{
15
    private TractorMassPayloadUtilInterface $tractorMassPayloadUtil;
16
17 4
    public function __construct(
18
        TractorMassPayloadUtilInterface $tractorMassPayloadUtil
19
    ) {
20 4
        $this->tractorMassPayloadUtil = $tractorMassPayloadUtil;
21
    }
22
23 2
    protected function triggerSpecific(
24
        ShipWrapperInterface $wrapper,
25
        FlightRouteInterface $flightRoute,
26
        MessageCollectionInterface $messages
27
    ): void {
28
29 2
        $tractoredShip = $wrapper->get()->getTractoredShip();
30 2
        if ($tractoredShip === null) {
31 1
            return;
32
        }
33
34
        //check for tractor system health
35 1
        $this->tractorMassPayloadUtil->stressTractorSystemForTowing(
36 1
            $wrapper,
37 1
            $tractoredShip,
38 1
            $messages
39 1
        );
40
    }
41
}
42