1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Stu\Component\Spacecraft\System\Data; |
6
|
|
|
|
7
|
|
|
use Override; |
|
|
|
|
8
|
|
|
use Stu\Component\Spacecraft\System\SpacecraftSystemTypeEnum; |
9
|
|
|
use Stu\Module\Template\StatusBarFactoryInterface; |
10
|
|
|
use Stu\Orm\Entity\FlightSignature; |
11
|
|
|
use Stu\Orm\Entity\Spacecraft; |
12
|
|
|
use Stu\Orm\Repository\SpacecraftSystemRepositoryInterface; |
13
|
|
|
use Stu\Orm\Repository\FlightSignatureRepositoryInterface; |
14
|
|
|
|
15
|
|
|
class SubspaceSystemData extends AbstractSystemData |
16
|
|
|
{ |
17
|
|
|
public ?int $spacecraftId = null; |
18
|
|
|
public ?int $analyzeTime = null; |
19
|
|
|
public ?int $flightSigId = null; |
20
|
|
|
|
21
|
|
|
public function __construct( |
22
|
|
|
SpacecraftSystemRepositoryInterface $shipSystemRepository, |
23
|
|
|
StatusBarFactoryInterface $statusBarFactory, |
24
|
|
|
private readonly FlightSignatureRepositoryInterface $flightSignatureRepository |
25
|
|
|
) { |
26
|
|
|
parent::__construct($shipSystemRepository, $statusBarFactory); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
#[Override] |
30
|
|
|
public function getSystemType(): SpacecraftSystemTypeEnum |
31
|
|
|
{ |
32
|
|
|
return SpacecraftSystemTypeEnum::SUBSPACE_SCANNER; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
public function getSpacecraftId(): ?int |
36
|
|
|
{ |
37
|
|
|
return $this->spacecraftId ?? null; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function setSpacecraftId(?int $spacecraftId): SubspaceSystemData |
41
|
|
|
{ |
42
|
|
|
$this->spacecraftId = $spacecraftId; |
43
|
|
|
return $this; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function getAnalyzeTime(): ?int |
47
|
|
|
{ |
48
|
|
|
return $this->analyzeTime ?? null; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function setAnalyzeTime(?int $analyzeTime): SubspaceSystemData |
52
|
|
|
{ |
53
|
|
|
$this->analyzeTime = $analyzeTime; |
54
|
|
|
return $this; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function getFlightSigId(): ?int |
58
|
|
|
{ |
59
|
|
|
return $this->flightSigId ?? null; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public function setFlightSigId(?int $flightSigId): SubspaceSystemData |
63
|
|
|
{ |
64
|
|
|
$this->flightSigId = $flightSigId; |
65
|
|
|
return $this; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
public function getHighlightedFlightSig(Spacecraft $spacecraft): ?FlightSignature |
69
|
|
|
{ |
70
|
|
|
$isSubspaceScannerActive = $spacecraft->getSystemState(SpacecraftSystemTypeEnum::SUBSPACE_SCANNER); |
71
|
|
|
if (!$isSubspaceScannerActive) { |
72
|
|
|
return null; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
$isMatrixScannerHealthy = $spacecraft->isSystemHealthy(SpacecraftSystemTypeEnum::MATRIX_SCANNER); |
76
|
|
|
if (!$isMatrixScannerHealthy) { |
77
|
|
|
return null; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
$subspaceSystem = $spacecraft->getSpacecraftSystem(SpacecraftSystemTypeEnum::SUBSPACE_SCANNER); |
81
|
|
|
if ($subspaceSystem->getData() === null) { |
82
|
|
|
return null; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
$analyzeTime = $this->getAnalyzeTime(); |
86
|
|
|
if ($analyzeTime === null) { |
87
|
|
|
return null; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
$currentTime = time(); |
91
|
|
|
$minTime = $analyzeTime + (3 * 60); |
92
|
|
|
$maxTime = $analyzeTime + (10 * 60); |
93
|
|
|
|
94
|
|
|
if (!($currentTime >= $minTime && $currentTime <= $maxTime)) { |
95
|
|
|
return null; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
$flightSigId = $this->getFlightSigId(); |
99
|
|
|
if ($flightSigId) { |
|
|
|
|
100
|
|
|
$flightSig = $this->flightSignatureRepository->find($flightSigId); |
101
|
|
|
return $flightSig; |
102
|
|
|
} else { |
103
|
|
|
return null; |
104
|
|
|
} |
105
|
|
|
} |
106
|
|
|
} |
107
|
|
|
|
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