Passed
Push — dev ( 368876...ca533f )
by Janko
16:00
created

StationWrapper::canBeScrapped()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
ccs 3
cts 3
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\SpacecraftStateEnum;
7
use Stu\Component\Spacecraft\System\Data\AggregationSystemSystemData;
8
use Stu\Component\Spacecraft\System\SpacecraftSystemTypeEnum;
9
use Stu\Module\Ship\Lib\FleetWrapperInterface;
10
use Stu\Module\Spacecraft\Lib\SpacecraftWrapper;
11
use Stu\Orm\Entity\StationInterface;
12
13
/**
14
 * @extends SpacecraftWrapper<StationInterface>
15
 */
16
class StationWrapper extends SpacecraftWrapper implements StationWrapperInterface
17
{
18 21
    #[Override]
19
    public function get(): StationInterface
20
    {
21 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...
22
    }
23
24
    #[Override]
25
    public function getFleetWrapper(): ?FleetWrapperInterface
26
    {
27
        return null;
28
    }
29
30 3
    #[Override]
31
    public function canBeScrapped(): bool
32
    {
33 3
        $station = $this->get();
34
35 3
        return $station->getState() !== SpacecraftStateEnum::UNDER_SCRAPPING;
36
    }
37
38 1
    #[Override]
39
    public function getAggregationSystemSystemData(): ?AggregationSystemSystemData
40
    {
41 1
        return $this->getSpecificShipSystem(
42 1
            SpacecraftSystemTypeEnum::AGGREGATION_SYSTEM,
43 1
            AggregationSystemSystemData::class
44 1
        );
45
    }
46
}
47