|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Stu\Lib\Transfer\Wrapper; |
|
6
|
|
|
|
|
7
|
|
|
use Override; |
|
|
|
|
|
|
8
|
|
|
use Stu\Lib\Information\InformationInterface; |
|
9
|
|
|
use Stu\Lib\Transfer\EntityWithStorageInterface; |
|
10
|
|
|
use Stu\Module\Spacecraft\Lib\Torpedo\ShipTorpedoManagerInterface; |
|
11
|
|
|
use Stu\Module\Spacecraft\Lib\SpacecraftWrapperInterface; |
|
12
|
|
|
use Stu\Orm\Entity\LocationInterface; |
|
13
|
|
|
use Stu\Orm\Entity\SpacecraftInterface; |
|
14
|
|
|
use Stu\Orm\Entity\TorpedoTypeInterface; |
|
15
|
|
|
use Stu\Orm\Entity\UserInterface; |
|
16
|
|
|
|
|
17
|
|
|
class SpacecraftStorageEntityWrapper implements StorageEntityWrapperInterface |
|
18
|
|
|
{ |
|
19
|
|
|
private SpacecraftInterface $spacecraft; |
|
20
|
|
|
|
|
21
|
13 |
|
public function __construct( |
|
22
|
|
|
private readonly ShipTorpedoManagerInterface $shipTorpedoManager, |
|
23
|
|
|
private readonly SpacecraftStorageCommodityLogic $commodityLogic, |
|
24
|
|
|
private readonly SpacecraftStorageCrewLogic $crewLogic, |
|
25
|
|
|
private readonly SpacecraftStorageTorpedoLogic $torpedoLogic, |
|
26
|
|
|
private SpacecraftWrapperInterface $spacecraftWrapper |
|
27
|
|
|
) { |
|
28
|
13 |
|
$this->spacecraft = $spacecraftWrapper->get(); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
// GENERAL |
|
32
|
13 |
|
#[Override] |
|
33
|
|
|
public function get(): EntityWithStorageInterface |
|
34
|
|
|
{ |
|
35
|
13 |
|
return $this->spacecraft; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
13 |
|
#[Override] |
|
39
|
|
|
public function getUser(): UserInterface |
|
40
|
|
|
{ |
|
41
|
13 |
|
return $this->spacecraft->getUser(); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
10 |
|
#[Override] |
|
45
|
|
|
public function getName(): string |
|
46
|
|
|
{ |
|
47
|
10 |
|
return $this->spacecraft->getName(); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
#[Override] |
|
51
|
|
|
public function canTransfer(InformationInterface $information): bool |
|
52
|
|
|
{ |
|
53
|
|
|
if (!$this->spacecraft->hasEnoughCrew()) { |
|
54
|
|
|
$information->addInformation("Ungenügend Crew vorhanden"); |
|
55
|
|
|
return false; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
return true; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
#[Override] |
|
62
|
|
|
public function getLocation(): LocationInterface |
|
63
|
|
|
{ |
|
64
|
|
|
return $this->spacecraft->getLocation(); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
// COMMODITIES |
|
68
|
11 |
|
#[Override] |
|
69
|
|
|
public function getBeamFactor(): int |
|
70
|
|
|
{ |
|
71
|
11 |
|
return $this->spacecraft->getRump()->getBeamFactor(); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
#[Override] |
|
75
|
|
|
public function transfer( |
|
76
|
|
|
bool $isUnload, |
|
77
|
|
|
StorageEntityWrapperInterface $target, |
|
78
|
|
|
InformationInterface $information |
|
79
|
|
|
): void { |
|
80
|
|
|
|
|
81
|
|
|
$this->commodityLogic->transfer($isUnload, $this->spacecraftWrapper, $target, $information); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
// CREW |
|
85
|
4 |
|
#[Override] |
|
86
|
|
|
public function getMaxTransferrableCrew(bool $isTarget, UserInterface $user): int |
|
87
|
|
|
{ |
|
88
|
4 |
|
return $this->crewLogic->getMaxTransferrableCrew($this->spacecraft, $isTarget, $user); |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
4 |
|
#[Override] |
|
92
|
|
|
public function getFreeCrewSpace(UserInterface $user): int |
|
93
|
|
|
{ |
|
94
|
4 |
|
return $this->crewLogic->getFreeCrewSpace($this->spacecraft, $user); |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
#[Override] |
|
98
|
|
|
public function checkCrewStorage(int $amount, bool $isUnload, InformationInterface $information): bool |
|
99
|
|
|
{ |
|
100
|
|
|
return $this->crewLogic->checkCrewStorage($this->spacecraftWrapper, $amount, $isUnload, $information); |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
#[Override] |
|
104
|
|
|
public function acceptsCrewFrom(int $amount, UserInterface $user, InformationInterface $information): bool |
|
105
|
|
|
{ |
|
106
|
|
|
return $this->crewLogic->acceptsCrewFrom($this->spacecraftWrapper, $amount, $user, $information); |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
#[Override] |
|
110
|
|
|
public function postCrewTransfer(int $foreignCrewChangeAmount, StorageEntityWrapperInterface $other, InformationInterface $information): void |
|
111
|
|
|
{ |
|
112
|
|
|
$this->crewLogic->postCrewTransfer($this->spacecraftWrapper, $foreignCrewChangeAmount, $information); |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
// TORPEDOS |
|
116
|
|
|
|
|
117
|
|
|
#[Override] |
|
118
|
|
|
public function getTorpedo(): ?TorpedoTypeInterface |
|
119
|
|
|
{ |
|
120
|
|
|
return $this->spacecraft->getTorpedo(); |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
#[Override] |
|
124
|
|
|
public function getTorpedoCount(): int |
|
125
|
|
|
{ |
|
126
|
|
|
return $this->spacecraft->getTorpedoCount(); |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
#[Override] |
|
130
|
|
|
public function getMaxTorpedos(): int |
|
131
|
|
|
{ |
|
132
|
|
|
return $this->spacecraft->getMaxTorpedos(); |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
#[Override] |
|
136
|
|
|
public function canTransferTorpedos(InformationInterface $information): bool |
|
137
|
|
|
{ |
|
138
|
|
|
return $this->torpedoLogic->canTransferTorpedos($this->spacecraft, $information); |
|
139
|
|
|
} |
|
140
|
|
|
|
|
141
|
|
|
#[Override] |
|
142
|
|
|
public function canStoreTorpedoType(TorpedoTypeInterface $torpedoType, InformationInterface $information): bool |
|
143
|
|
|
{ |
|
144
|
|
|
return $this->torpedoLogic->canStoreTorpedoType($this->spacecraft, $torpedoType, $information); |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
#[Override] |
|
148
|
|
|
public function changeTorpedo(int $changeAmount, TorpedoTypeInterface $type): void |
|
149
|
|
|
{ |
|
150
|
|
|
$this->shipTorpedoManager->changeTorpedo( |
|
151
|
|
|
$this->spacecraftWrapper, |
|
152
|
|
|
$changeAmount, |
|
153
|
|
|
$type |
|
154
|
|
|
); |
|
155
|
|
|
} |
|
156
|
|
|
} |
|
157
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths