Passed
Push — master ( bf860f...1dd8f7 )
by Nico
57:55 queued 29:36
created

CancelTakeover   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 33.33%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 17
ccs 2
cts 6
cp 0.3333
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handleShipDestruction() 0 10 1
A __construct() 0 3 1
1
<?php
2
3
namespace Stu\Module\Ship\Lib\Destruction\Handler;
4
5
use Stu\Lib\Information\InformationInterface;
6
use Stu\Module\Ship\Lib\Destruction\ShipDestroyerInterface;
7
use Stu\Module\Ship\Lib\Destruction\ShipDestructionCauseEnum;
8
use Stu\Module\Ship\Lib\Interaction\ShipTakeoverManagerInterface;
9
use Stu\Module\Ship\Lib\ShipWrapperInterface;
10
11
class CancelTakeover implements ShipDestructionHandlerInterface
12
{
13 1
    public function __construct(
14
        private ShipTakeoverManagerInterface $shipTakeoverManager
15
    ) {
16 1
    }
17
18
    public function handleShipDestruction(
19
        ?ShipDestroyerInterface $destroyer,
20
        ShipWrapperInterface $destroyedShipWrapper,
21
        ShipDestructionCauseEnum $cause,
22
        InformationInterface $informations
23
    ): void {
24
25
        $this->shipTakeoverManager->cancelBothTakeover(
26
            $destroyedShipWrapper->get(),
27
            ', da das Schiff zerstört wurde'
28
        );
29
    }
30
}
31