Passed
Push — dev ( 5b1d95...923b08 )
by Janko
23:33 queued 07:31
created

FinishedTakeoverHandler   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 22.22%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handleSpacecraftTick() 0 15 3
A __construct() 0 3 1
1
<?php
2
3
namespace Stu\Module\Tick\Spacecraft\Handler;
4
5
use Override;
0 ignored issues
show
Bug introduced by
The type Override was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Stu\Lib\Information\InformationInterface;
7
use Stu\Module\Spacecraft\Lib\Interaction\ShipTakeoverManagerInterface;
8
use Stu\Module\Spacecraft\Lib\SpacecraftWrapperInterface;
9
10
class FinishedTakeoverHandler implements SpacecraftTickHandlerInterface
11
{
12 1
    public function __construct(
13
        private ShipTakeoverManagerInterface $shipTakeoverManager
14 1
    ) {}
15
16
    #[Override]
17
    public function handleSpacecraftTick(
18
        SpacecraftWrapperInterface $wrapper,
19
        InformationInterface $information
20
    ): void {
21
22
23
        $takeover = $wrapper->get()->getTakeoverActive();
24
        if ($takeover === null) {
25
            return;
26
        }
27
28
        $isTakeoverReady = $this->shipTakeoverManager->isTakeoverReady($takeover);
29
        if ($isTakeoverReady) {
30
            $this->shipTakeoverManager->finishTakeover($takeover);
31
        }
32
    }
33
}
34