Passed
Push — dev ( 996fbb...25004f )
by Janko
16:40
created

TrumfieldStorageEntityWrapper   A

Complexity

Total Complexity 19

Size/Duplication

Total Lines 118
Duplicated Lines 0 %

Test Coverage

Coverage 21.05%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 36
dl 0
loc 118
ccs 8
cts 38
cp 0.2105
rs 10
c 1
b 0
f 0
wmc 19

19 Methods

Rating   Name   Duplication   Size   Complexity  
A getTorpedo() 0 4 1
A postCrewTransfer() 0 2 1
A getName() 0 4 1
A get() 0 4 1
A canStoreTorpedoType() 0 4 1
A transfer() 0 7 1
A acceptsCrewFrom() 0 4 1
A getTorpedoCount() 0 4 1
A changeTorpedo() 0 4 1
A canTransferTorpedos() 0 4 1
A getMaxTransferrableCrew() 0 4 1
A getMaxTorpedos() 0 4 1
A checkCrewStorage() 0 4 1
A __construct() 0 4 1
A getUser() 0 4 1
A getFreeCrewSpace() 0 4 1
A getLocation() 0 4 1
A canTransfer() 0 4 1
A getBeamFactor() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Lib\Transfer\Wrapper;
6
7
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...
8
use RuntimeException;
9
use Stu\Lib\Information\InformationInterface;
10
use Stu\Lib\Transfer\EntityWithStorageInterface;
11
use Stu\Orm\Entity\LocationInterface;
12
use Stu\Orm\Entity\TorpedoTypeInterface;
13
use Stu\Orm\Entity\TrumfieldInterface;
14
use Stu\Orm\Entity\UserInterface;
15
use Stu\Orm\Repository\UserRepositoryInterface;
16
17
class TrumfieldStorageEntityWrapper implements StorageEntityWrapperInterface
18
{
19 1
    public function __construct(
20
        private UserRepositoryInterface $userRepository,
21
        private TrumfieldInterface $trumfield
22 1
    ) {}
23
24
    // GENERAL
25 1
    #[Override]
26
    public function get(): EntityWithStorageInterface
27
    {
28 1
        return $this->trumfield;
29
    }
30
31 1
    #[Override]
32
    public function getUser(): UserInterface
33
    {
34 1
        return $this->userRepository->getFallbackUser();
35
    }
36
37 1
    #[Override]
38
    public function getName(): string
39
    {
40 1
        return 'Trümmerfeld';
41
    }
42
43
    #[Override]
44
    public function canTransfer(InformationInterface $information): bool
45
    {
46
        return false;
47
    }
48
49
    #[Override]
50
    public function getLocation(): LocationInterface
51
    {
52
        return $this->trumfield->getLocation();
53
    }
54
55
    // COMMODITIES
56
    #[Override]
57
    public function getBeamFactor(): int
58
    {
59
        throw new RuntimeException('this should not happen');
60
    }
61
62
    #[Override]
63
    public function transfer(
64
        bool $isUnload,
65
        StorageEntityWrapperInterface $target,
66
        InformationInterface $information
67
    ): void {
68
        throw new RuntimeException('this should not happen');
69
    }
70
71
    // CREW
72
    #[Override]
73
    public function getMaxTransferrableCrew(bool $isTarget, UserInterface $user): int
74
    {
75
        return 0;
76
    }
77
78
    #[Override]
79
    public function getFreeCrewSpace(UserInterface $user): int
80
    {
81
        return 0;
82
    }
83
84
    #[Override]
85
    public function checkCrewStorage(int $amount, bool $isUnload, InformationInterface $information): bool
86
    {
87
        return false;
88
    }
89
90
    #[Override]
91
    public function acceptsCrewFrom(int $amount, UserInterface $user, InformationInterface $information): bool
92
    {
93
        return false;
94
    }
95
96
    #[Override]
97
    public function postCrewTransfer(int $foreignCrewChangeAmount, StorageEntityWrapperInterface $other, InformationInterface $information): void {}
98
99
    // TORPEDOS
100
101
    #[Override]
102
    public function getTorpedo(): ?TorpedoTypeInterface
103
    {
104
        return null;
105
    }
106
107
    #[Override]
108
    public function getTorpedoCount(): int
109
    {
110
        return 0;
111
    }
112
113
    #[Override]
114
    public function getMaxTorpedos(): int
115
    {
116
        return 0;
117
    }
118
119
    #[Override]
120
    public function canTransferTorpedos(InformationInterface $information): bool
121
    {
122
        return false;
123
    }
124
125
    #[Override]
126
    public function canStoreTorpedoType(TorpedoTypeInterface $torpedoType, InformationInterface $information): bool
127
    {
128
        return false;
129
    }
130
131
    #[Override]
132
    public function changeTorpedo(int $changeAmount, TorpedoTypeInterface $type): void
133
    {
134
        throw new RuntimeException('this should not happen');
135
    }
136
}
137