1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Stu\Module\Spacecraft\View\ShowSystemSettings; |
6
|
|
|
|
7
|
|
|
use Stu\Component\Spacecraft\System\SpacecraftSystemTypeEnum; |
8
|
|
|
use Stu\Component\Spacecraft\System\SpacecraftSystemWrapperFactoryInterface; |
9
|
|
|
use Stu\Module\Control\GameControllerInterface; |
|
|
|
|
10
|
|
|
use Stu\Module\Spacecraft\Lib\SpacecraftWrapperInterface; |
11
|
|
|
use Stu\Orm\Repository\FlightSignatureRepositoryInterface; |
12
|
|
|
|
13
|
|
|
class SubspaceSensorSystemSettings implements SystemSettingsProviderInterface |
14
|
|
|
{ |
15
|
1 |
|
public function __construct( |
16
|
|
|
private readonly SpacecraftSystemWrapperFactoryInterface $spacecraftSystemWrapperFactory, |
17
|
|
|
private FlightSignatureRepositoryInterface $flightSignatureRepository |
18
|
1 |
|
) {} |
19
|
|
|
|
20
|
|
|
public function setTemplateVariables( |
21
|
|
|
SpacecraftSystemTypeEnum $systemType, |
22
|
|
|
SpacecraftWrapperInterface $wrapper, |
23
|
|
|
GameControllerInterface $game |
24
|
|
|
): void { |
25
|
|
|
$game->setMacroInAjaxWindow('html/spacecraft/system/subspaceScanner.twig'); |
26
|
|
|
|
27
|
|
|
$user = $game->getUser(); |
28
|
|
|
$spacecraft = $wrapper->get(); |
29
|
|
|
|
30
|
|
|
$isSubspaceScannerActive = $spacecraft->getSystemState(SpacecraftSystemTypeEnum::SUBSPACE_SCANNER); |
31
|
|
|
|
32
|
|
|
|
33
|
|
|
$isMatrixScannerHealthy = $spacecraft->isSystemHealthy(SpacecraftSystemTypeEnum::MATRIX_SCANNER); |
34
|
|
|
if ($isMatrixScannerHealthy && $isSubspaceScannerActive) { |
35
|
|
|
|
36
|
|
|
$location = $spacecraft->getLocation(); |
37
|
|
|
$layerId = null; |
38
|
|
|
|
39
|
|
|
$subspaceSystemData = $wrapper->getSubspaceSystemData(); |
40
|
|
|
if ($subspaceSystemData === null) { |
41
|
|
|
return; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
$flightSigId = $subspaceSystemData->getFlightSigId(); |
45
|
|
|
if ($flightSigId) { |
|
|
|
|
46
|
|
|
$flightSig = $this->flightSignatureRepository->find($flightSigId); |
47
|
|
|
$game->setTemplateVar('ANALYZED_SIGNATURE', $flightSig); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
$analyzeTime = $subspaceSystemData->getAnalyzeTime(); |
51
|
|
|
if ($analyzeTime) { |
|
|
|
|
52
|
|
|
$currentTime = time(); |
53
|
|
|
$maxTime = $analyzeTime + (10 * 60); |
54
|
|
|
$game->setTemplateVar('ANALYZE_TIME', $analyzeTime); |
55
|
|
|
|
56
|
|
|
if ($currentTime <= $maxTime) { |
57
|
|
|
$game->setTemplateVar('ANALYZE_TIME', $analyzeTime); |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
|
62
|
|
|
$system = $spacecraft->getSystem(); |
63
|
|
|
if ($system) { |
64
|
|
|
$cx = $system->getCx(); |
65
|
|
|
$cy = $system->getCy(); |
66
|
|
|
} else { |
67
|
|
|
$cx = $location->getCx(); |
68
|
|
|
$cy = $location->getCy(); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
if ($location->getLayer()) { |
72
|
|
|
$layerId = $location->getLayer()->getId(); |
73
|
|
|
} |
74
|
|
|
$timeThreshold = time() - (12 * 3600); |
75
|
|
|
|
76
|
|
|
$sensorRange = $wrapper->getLssSystemData()?->getSensorRange() ?? 0; |
77
|
|
|
|
78
|
|
|
if ($cx && $cy && $layerId) { |
79
|
|
|
$signatures = $this->flightSignatureRepository->getSignaturesInSensorRange( |
80
|
|
|
$user->getId(), |
81
|
|
|
$cx, |
82
|
|
|
$cy, |
83
|
|
|
$layerId, |
84
|
|
|
$sensorRange, |
85
|
|
|
$timeThreshold |
86
|
|
|
); |
87
|
|
|
$game->setTemplateVar('SIGNATURES', $signatures); |
88
|
|
|
} |
89
|
|
|
} else { |
90
|
|
|
$game->setTemplateVar('SYSTEMWARNING', true); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
|
94
|
|
|
|
95
|
|
|
$game->setTemplateVar('USER', $user); |
96
|
|
|
$game->setTemplateVar('SPACECRAFT', $spacecraft); |
97
|
|
|
$game->setTemplateVar( |
98
|
|
|
'systemWrapper', |
99
|
|
|
$this->spacecraftSystemWrapperFactory->create($wrapper->get(), $systemType) |
100
|
|
|
); |
101
|
|
|
} |
102
|
|
|
} |
103
|
|
|
|
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