Passed
Push — dev ( 2eb11f...3c2dab )
by Janko
09:11
created

StationWrapper::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Stu\Module\Station\Lib;
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\Component\Spacecraft\Repair\RepairUtilInterface;
7
use Stu\Component\Spacecraft\SpacecraftStateEnum;
8
use Stu\Component\Spacecraft\System\Data\AggregationSystemSystemData;
9
use Stu\Component\Spacecraft\System\SpacecraftSystemManagerInterface;
10
use Stu\Component\Spacecraft\System\SpacecraftSystemTypeEnum;
11
use Stu\Component\Spacecraft\System\SystemDataDeserializerInterface;
12
use Stu\Module\Control\GameControllerInterface;
13
use Stu\Module\Ship\Lib\FleetWrapperInterface;
14
use Stu\Module\Spacecraft\Lib\SpacecraftStateChangerInterface;
15
use Stu\Module\Spacecraft\Lib\SpacecraftWrapperFactoryInterface;
16
use Stu\Module\Spacecraft\Lib\Ui\StateIconAndTitle;
17
use Stu\Module\Spacecraft\Lib\SpacecraftWrapper;
18
use Stu\Orm\Entity\StationInterface;
19
use Stu\Orm\Repository\TorpedoTypeRepositoryInterface;
20
21
/**
22
 * @extends SpacecraftWrapper<StationInterface>
23
 */
24
class StationWrapper extends SpacecraftWrapper implements StationWrapperInterface
25
{
26 21
    public function __construct(
27
        StationInterface $station,
28
        SpacecraftSystemManagerInterface $spacecraftSystemManager,
29
        SystemDataDeserializerInterface $systemDataDeserializer,
30
        TorpedoTypeRepositoryInterface $torpedoTypeRepository,
31
        GameControllerInterface $game,
32
        SpacecraftWrapperFactoryInterface $spacecraftWrapperFactory,
33
        SpacecraftStateChangerInterface $spacecraftStateChanger,
34
        RepairUtilInterface $repairUtil,
35
        StateIconAndTitle $stateIconAndTitle
36
    ) {
37 21
        parent::__construct(
38 21
            $station,
39 21
            $spacecraftSystemManager,
40 21
            $systemDataDeserializer,
41 21
            $torpedoTypeRepository,
42 21
            $game,
43 21
            $spacecraftWrapperFactory,
44 21
            $spacecraftStateChanger,
45 21
            $repairUtil,
46 21
            $stateIconAndTitle
47 21
        );
48
    }
49
50 21
    #[Override]
51
    public function get(): StationInterface
52
    {
53 21
        return $this->spacecraft;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->spacecraft returns the type Stu\Orm\Entity\SpacecraftInterface which includes types incompatible with the type-hinted return Stu\Orm\Entity\StationInterface.
Loading history...
54
    }
55
56
    #[Override]
57
    public function getFleetWrapper(): ?FleetWrapperInterface
58
    {
59
        return null;
60
    }
61
62 3
    #[Override]
63
    public function canBeScrapped(): bool
64
    {
65 3
        $station = $this->get();
66
67 3
        return $station->getState() !== SpacecraftStateEnum::SHIP_STATE_UNDER_SCRAPPING;
68
    }
69
70 1
    #[Override]
71
    public function getAggregationSystemSystemData(): ?AggregationSystemSystemData
72
    {
73 1
        return $this->getSpecificShipSystem(
74 1
            SpacecraftSystemTypeEnum::AGGREGATION_SYSTEM,
75 1
            AggregationSystemSystemData::class
76 1
        );
77
    }
78
}
79