|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Stu\Module\Colony\Lib; |
|
6
|
|
|
|
|
7
|
|
|
use Doctrine\ORM\EntityManagerInterface; |
|
8
|
|
|
use Override; |
|
|
|
|
|
|
9
|
|
|
use Stu\Component\Colony\ColonyFunctionManagerInterface; |
|
10
|
|
|
use Stu\Component\Colony\ColonyPopulationCalculator; |
|
11
|
|
|
use Stu\Component\Colony\ColonyPopulationCalculatorInterface; |
|
12
|
|
|
use Stu\Component\Colony\Commodity\ColonyCommodityProduction; |
|
13
|
|
|
use Stu\Component\Colony\Commodity\ColonyCommodityProductionInterface; |
|
14
|
|
|
use Stu\Component\Colony\Commodity\ColonyProductionSumReducer; |
|
15
|
|
|
use Stu\Component\Colony\Commodity\ColonyProductionSumReducerInterface; |
|
16
|
|
|
use Stu\Component\Colony\Shields\ColonyShieldingManager; |
|
17
|
|
|
use Stu\Component\Colony\Shields\ColonyShieldingManagerInterface; |
|
18
|
|
|
use Stu\Component\Ship\ShipModuleTypeEnum; |
|
19
|
|
|
use Stu\Lib\Colony\PlanetFieldHostInterface; |
|
20
|
|
|
use Stu\Lib\ColonyProduction\ColonyProduction; |
|
21
|
|
|
use Stu\Lib\Map\VisualPanel\Layer\PanelLayerCreationInterface; |
|
22
|
|
|
use Stu\Lib\ModuleScreen\Addon\ModuleSelectorAddonFactoryInterface; |
|
23
|
|
|
use Stu\Lib\ModuleScreen\ModuleSelector; |
|
24
|
|
|
use Stu\Module\Colony\Lib\Gui\ColonyScanPanel; |
|
25
|
|
|
use Stu\Module\Commodity\Lib\CommodityCacheInterface; |
|
26
|
|
|
use Stu\Module\Logging\LoggerUtilFactoryInterface; |
|
27
|
|
|
use Stu\Module\Template\StatusBarFactoryInterface; |
|
28
|
|
|
use Stu\Module\Twig\TwigPageInterface; |
|
29
|
|
|
use Stu\Orm\Entity\BuildingInterface; |
|
30
|
|
|
use Stu\Orm\Entity\ColonyInterface; |
|
31
|
|
|
use Stu\Orm\Entity\CommodityInterface; |
|
32
|
|
|
use Stu\Orm\Entity\ShipBuildplanInterface; |
|
33
|
|
|
use Stu\Orm\Entity\ShipInterface; |
|
34
|
|
|
use Stu\Orm\Entity\ShipRumpInterface; |
|
35
|
|
|
use Stu\Orm\Entity\UserInterface; |
|
36
|
|
|
use Stu\Orm\Repository\BuildingCommodityRepositoryInterface; |
|
37
|
|
|
use Stu\Orm\Repository\BuildingRepositoryInterface; |
|
38
|
|
|
use Stu\Orm\Repository\ColonyRepositoryInterface; |
|
39
|
|
|
use Stu\Orm\Repository\FlightSignatureRepositoryInterface; |
|
40
|
|
|
use Stu\Orm\Repository\ModuleRepositoryInterface; |
|
41
|
|
|
use Stu\Orm\Repository\PlanetFieldRepositoryInterface; |
|
42
|
|
|
use Stu\Orm\Repository\ResearchedRepositoryInterface; |
|
43
|
|
|
use Stu\Orm\Repository\ShipBuildplanRepositoryInterface; |
|
44
|
|
|
use Stu\Orm\Repository\ShipRepositoryInterface; |
|
45
|
|
|
use Stu\Orm\Repository\ShipRumpModuleLevelRepositoryInterface; |
|
46
|
|
|
use Stu\PlanetGenerator\PlanetGeneratorInterface; |
|
47
|
|
|
|
|
48
|
|
|
final class ColonyLibFactory implements ColonyLibFactoryInterface |
|
49
|
|
|
{ |
|
50
|
2 |
|
public function __construct( |
|
51
|
|
|
private PlanetFieldRepositoryInterface $planetFieldRepository, |
|
52
|
|
|
private BuildingRepositoryInterface $buildingRepository, |
|
53
|
|
|
private ColonyRepositoryInterface $colonyRepository, |
|
54
|
|
|
private CommodityConsumptionInterface $commodityConsumption, |
|
55
|
|
|
private ShipRepositoryInterface $shipRepository, |
|
56
|
|
|
private ShipBuildplanRepositoryInterface $shipBuildplanRepository, |
|
57
|
|
|
private ResearchedRepositoryInterface $researchedRepository, |
|
58
|
|
|
private FlightSignatureRepositoryInterface $flightSignatureRepository, |
|
59
|
|
|
private PlanetGeneratorInterface $planetGenerator, |
|
60
|
|
|
private EntityManagerInterface $entityManager, |
|
61
|
|
|
private BuildingCommodityRepositoryInterface $buildingCommodityRepository, |
|
62
|
|
|
private ModuleRepositoryInterface $moduleRepository, |
|
63
|
|
|
private ShipRumpModuleLevelRepositoryInterface $shipRumpModuleLevelRepository, |
|
64
|
|
|
private TwigPageInterface $twigPage, |
|
65
|
|
|
private PlanetFieldTypeRetrieverInterface $planetFieldTypeRetriever, |
|
66
|
|
|
private ColonyFunctionManagerInterface $colonyFunctionManager, |
|
67
|
|
|
private ModuleSelectorAddonFactoryInterface $moduleSelectorAddonFactory, |
|
68
|
|
|
private CommodityCacheInterface $commodityCache, |
|
69
|
|
|
private StatusBarFactoryInterface $statusBarFactory, |
|
70
|
|
|
private PanelLayerCreationInterface $panelLayerCreation, |
|
71
|
|
|
private LoggerUtilFactoryInterface $loggerUtilFactory |
|
72
|
2 |
|
) {} |
|
73
|
|
|
|
|
74
|
|
|
#[Override] |
|
75
|
|
|
public function createBuildingFunctionWrapper( |
|
76
|
|
|
array $buildingfunctions |
|
77
|
|
|
): BuildingFunctionWrapperInterface { |
|
78
|
|
|
return new BuildingFunctionWrapper($buildingfunctions); |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
#[Override] |
|
82
|
|
|
public function createColonySurface( |
|
83
|
|
|
PlanetFieldHostInterface $host, |
|
84
|
|
|
?int $buildingId = null, |
|
85
|
|
|
bool $showUnderground = true |
|
86
|
|
|
): ColonySurfaceInterface { |
|
87
|
|
|
return new ColonySurface( |
|
88
|
|
|
$this->planetFieldRepository, |
|
89
|
|
|
$this->buildingRepository, |
|
90
|
|
|
$this->colonyRepository, |
|
91
|
|
|
$this->researchedRepository, |
|
92
|
|
|
$this->planetGenerator, |
|
93
|
|
|
$this->entityManager, |
|
94
|
|
|
$this->planetFieldTypeRetriever, |
|
95
|
|
|
$host, |
|
96
|
|
|
$buildingId, |
|
97
|
|
|
$showUnderground |
|
98
|
|
|
); |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
#[Override] |
|
102
|
|
|
public function createColonyListItem( |
|
103
|
|
|
ColonyInterface $colony |
|
104
|
|
|
): ColonyListItemInterface { |
|
105
|
|
|
return new ColonyListItem( |
|
106
|
|
|
$this, |
|
107
|
|
|
$this->planetFieldRepository, |
|
108
|
|
|
$this->commodityConsumption, |
|
109
|
|
|
$this->statusBarFactory, |
|
110
|
|
|
$colony, |
|
111
|
|
|
$this->flightSignatureRepository->getVisibleSignatureCount($colony) |
|
112
|
|
|
); |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
#[Override] |
|
116
|
|
|
public function createBuildableRumpItem( |
|
117
|
|
|
ShipRumpInterface $shipRump, |
|
118
|
|
|
UserInterface $currentUser |
|
119
|
|
|
): BuildableRumpListItemInterface { |
|
120
|
|
|
return new BuildableRumpListItem( |
|
121
|
|
|
$this->shipRepository, |
|
122
|
|
|
$this->shipBuildplanRepository, |
|
123
|
|
|
$shipRump, |
|
124
|
|
|
$currentUser |
|
125
|
|
|
); |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
#[Override] |
|
129
|
|
|
public function createColonyProductionPreviewWrapper( |
|
130
|
|
|
BuildingInterface $building, |
|
131
|
|
|
PlanetFieldHostInterface $host |
|
132
|
|
|
): ColonyProductionPreviewWrapper { |
|
133
|
|
|
return new ColonyProductionPreviewWrapper( |
|
134
|
|
|
$this, |
|
135
|
|
|
$building, |
|
136
|
|
|
$this->createColonyCommodityProduction($host)->getProduction() |
|
137
|
|
|
); |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
#[Override] |
|
141
|
|
|
public function createEpsProductionPreviewWrapper( |
|
142
|
|
|
PlanetFieldHostInterface $host, |
|
143
|
|
|
BuildingInterface $building |
|
144
|
|
|
): ColonyEpsProductionPreviewWrapper { |
|
145
|
|
|
return new ColonyEpsProductionPreviewWrapper( |
|
146
|
|
|
$this->planetFieldRepository, |
|
147
|
|
|
$host, |
|
148
|
|
|
$building |
|
149
|
|
|
); |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
#[Override] |
|
153
|
|
|
public function createModuleSelector( |
|
154
|
|
|
ShipModuleTypeEnum $moduleType, |
|
155
|
|
|
ColonyInterface|ShipInterface $host, |
|
156
|
|
|
ShipRumpInterface $rump, |
|
157
|
|
|
UserInterface $user, |
|
158
|
|
|
?ShipBuildplanInterface $buildplan = null |
|
159
|
|
|
): ModuleSelector { |
|
160
|
|
|
|
|
161
|
|
|
$addon = $this->moduleSelectorAddonFactory->createModuleSelectorAddon($moduleType); |
|
162
|
|
|
|
|
163
|
|
|
return new ModuleSelector( |
|
164
|
|
|
$this->moduleRepository, |
|
165
|
|
|
$this->shipRumpModuleLevelRepository, |
|
166
|
|
|
$this->twigPage, |
|
167
|
|
|
$moduleType, |
|
168
|
|
|
$host, |
|
169
|
|
|
$rump, |
|
170
|
|
|
$user, |
|
171
|
|
|
$addon, |
|
172
|
|
|
$buildplan |
|
173
|
|
|
); |
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
|
|
#[Override] |
|
177
|
|
|
public function createColonyProduction( |
|
178
|
|
|
CommodityInterface $commodity, |
|
179
|
|
|
int $production, |
|
180
|
|
|
?int $pc = null |
|
181
|
|
|
): ColonyProduction { |
|
182
|
|
|
return new ColonyProduction( |
|
183
|
|
|
$commodity, |
|
184
|
|
|
$production, |
|
185
|
|
|
$pc |
|
186
|
|
|
); |
|
187
|
|
|
} |
|
188
|
|
|
|
|
189
|
|
|
#[Override] |
|
190
|
|
|
public function createColonyShieldingManager( |
|
191
|
|
|
PlanetFieldHostInterface $host |
|
192
|
|
|
): ColonyShieldingManagerInterface { |
|
193
|
|
|
return new ColonyShieldingManager( |
|
194
|
|
|
$this->planetFieldRepository, |
|
195
|
|
|
$this->colonyFunctionManager, |
|
196
|
|
|
$host |
|
197
|
|
|
); |
|
198
|
|
|
} |
|
199
|
|
|
|
|
200
|
|
|
#[Override] |
|
201
|
|
|
public function createColonyCommodityProduction( |
|
202
|
|
|
PlanetFieldHostInterface $host |
|
203
|
|
|
): ColonyCommodityProductionInterface { |
|
204
|
|
|
return new ColonyCommodityProduction( |
|
205
|
|
|
$this->buildingCommodityRepository, |
|
206
|
|
|
$host, |
|
207
|
|
|
$this, |
|
208
|
|
|
$this->commodityCache |
|
209
|
|
|
); |
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
#[Override] |
|
213
|
|
|
public function createColonyProductionSumReducer(): ColonyProductionSumReducerInterface |
|
214
|
|
|
{ |
|
215
|
|
|
return new ColonyProductionSumReducer(); |
|
216
|
|
|
} |
|
217
|
|
|
|
|
218
|
|
|
#[Override] |
|
219
|
|
|
public function createColonyPopulationCalculator( |
|
220
|
|
|
PlanetFieldHostInterface $host, |
|
221
|
|
|
?array $production = null |
|
222
|
|
|
): ColonyPopulationCalculatorInterface { |
|
223
|
|
|
|
|
224
|
|
|
return new ColonyPopulationCalculator( |
|
225
|
|
|
$host, |
|
226
|
|
|
$production ?? $this->createColonyCommodityProduction($host)->getProduction() |
|
227
|
|
|
); |
|
228
|
|
|
} |
|
229
|
|
|
|
|
230
|
|
|
#[Override] |
|
231
|
|
|
public function createColonyScanPanel( |
|
232
|
|
|
ColonyInterface $colony |
|
233
|
|
|
): ColonyScanPanel { |
|
234
|
|
|
return new ColonyScanPanel( |
|
235
|
|
|
$this->panelLayerCreation, |
|
236
|
|
|
$colony, |
|
237
|
|
|
$this->colonyFunctionManager, |
|
238
|
|
|
$this->loggerUtilFactory->getLoggerUtil() |
|
239
|
|
|
); |
|
240
|
|
|
} |
|
241
|
|
|
} |
|
242
|
|
|
|
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