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

FinishedTakeoverHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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