Passed
Push — dev ( 80c162...225d4f )
by Janko
09:12
created

TholianWebWrapper::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 10
nc 1
nop 9
dl 0
loc 21
ccs 0
cts 11
cp 0
crap 2
rs 9.9332
c 1
b 1
f 0

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
namespace Stu\Module\Spacecraft\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\System\SpacecraftSystemManagerInterface;
8
use Stu\Component\Spacecraft\System\SystemDataDeserializerInterface;
9
use Stu\Module\Control\GameControllerInterface;
10
use Stu\Module\Ship\Lib\FleetWrapperInterface;
11
use Stu\Module\Spacecraft\Lib\SpacecraftStateChangerInterface;
12
use Stu\Module\Spacecraft\Lib\SpacecraftWrapperFactoryInterface;
13
use Stu\Module\Spacecraft\Lib\Ui\StateIconAndTitle;
14
use Stu\Module\Spacecraft\Lib\SpacecraftWrapper;
15
use Stu\Orm\Entity\TholianWebInterface;
16
use Stu\Orm\Repository\TorpedoTypeRepositoryInterface;
17
18
/**
19
 * @extends SpacecraftWrapper<TholianWebInterface>
20
 */
21
class TholianWebWrapper extends SpacecraftWrapper
22
{
23
    public function __construct(
24
        TholianWebInterface $tholianWeb,
25
        SpacecraftSystemManagerInterface $spacecraftSystemManager,
26
        SystemDataDeserializerInterface $systemDataDeserializer,
27
        TorpedoTypeRepositoryInterface $torpedoTypeRepository,
28
        GameControllerInterface $game,
29
        SpacecraftWrapperFactoryInterface $spacecraftWrapperFactory,
30
        SpacecraftStateChangerInterface $spacecraftStateChanger,
31
        RepairUtilInterface $repairUtil,
32
        StateIconAndTitle $stateIconAndTitle
33
    ) {
34
        parent::__construct(
35
            $tholianWeb,
36
            $spacecraftSystemManager,
37
            $systemDataDeserializer,
38
            $torpedoTypeRepository,
39
            $game,
40
            $spacecraftWrapperFactory,
41
            $spacecraftStateChanger,
42
            $repairUtil,
43
            $stateIconAndTitle
44
        );
45
    }
46
47
    #[Override]
48
    public function get(): TholianWebInterface
49
    {
50
        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\TholianWebInterface.
Loading history...
51
    }
52
53
    #[Override]
54
    public function getFleetWrapper(): ?FleetWrapperInterface
55
    {
56
        return null;
57
    }
58
}
59