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