Passed
Push — master ( 4ea0a9...ff5a87 )
by Janko
10:24
created

TrumfieldStorageEntityWrapper::canTransfer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
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
    #[Override]
56
    public function canPenetrateShields(UserInterface $user, InformationInterface $information): bool
57
    {
58
        return true;
59
    }
60
61
    // COMMODITIES
62
    #[Override]
63
    public function getBeamFactor(): int
64
    {
65
        throw new RuntimeException('this should not happen');
66
    }
67
68
    #[Override]
69
    public function transfer(
70
        bool $isUnload,
71
        StorageEntityWrapperInterface $target,
72
        InformationInterface $information
73
    ): void {
74
        throw new RuntimeException('this should not happen');
75
    }
76
77
    // CREW
78
    #[Override]
79
    public function getMaxTransferrableCrew(bool $isTarget, UserInterface $user): int
80
    {
81
        return 0;
82
    }
83
84
    #[Override]
85
    public function getFreeCrewSpace(UserInterface $user): int
86
    {
87
        return 0;
88
    }
89
90
    #[Override]
91
    public function checkCrewStorage(int $amount, bool $isUnload, InformationInterface $information): bool
92
    {
93
        return false;
94
    }
95
96
    #[Override]
97
    public function acceptsCrewFrom(int $amount, UserInterface $user, InformationInterface $information): bool
98
    {
99
        return false;
100
    }
101
102
    #[Override]
103
    public function postCrewTransfer(int $foreignCrewChangeAmount, StorageEntityWrapperInterface $other, InformationInterface $information): void {}
104
105
    // TORPEDOS
106
107
    #[Override]
108
    public function getTorpedo(): ?TorpedoTypeInterface
109
    {
110
        return null;
111
    }
112
113
    #[Override]
114
    public function getTorpedoCount(): int
115
    {
116
        return 0;
117
    }
118
119
    #[Override]
120
    public function getMaxTorpedos(): int
121
    {
122
        return 0;
123
    }
124
125
    #[Override]
126
    public function canTransferTorpedos(InformationInterface $information): bool
127
    {
128
        return false;
129
    }
130
131
    #[Override]
132
    public function canStoreTorpedoType(TorpedoTypeInterface $torpedoType, InformationInterface $information): bool
133
    {
134
        return false;
135
    }
136
137
    #[Override]
138
    public function changeTorpedo(int $changeAmount, TorpedoTypeInterface $type): void
139
    {
140
        throw new RuntimeException('this should not happen');
141
    }
142
}
143