|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Stu\Module\Spacecraft\Lib\Movement\Component\Consequence\Flight; |
|
6
|
|
|
|
|
7
|
|
|
use Override; |
|
|
|
|
|
|
8
|
|
|
use Stu\Component\Anomaly\Type\AnomalyTypeEnum; |
|
9
|
|
|
use Stu\Component\Spacecraft\SpacecraftAlertStateEnum; |
|
10
|
|
|
use Stu\Component\Spacecraft\System\SpacecraftSystemTypeEnum; |
|
11
|
|
|
use Stu\Module\Spacecraft\Lib\ActivatorDeactivatorHelperInterface; |
|
12
|
|
|
use Stu\Module\Spacecraft\Lib\Message\MessageCollectionInterface; |
|
13
|
|
|
use Stu\Module\Spacecraft\Lib\Message\MessageFactoryInterface; |
|
14
|
|
|
use Stu\Module\Spacecraft\Lib\Movement\Component\Consequence\AbstractFlightConsequence; |
|
15
|
|
|
use Stu\Module\Spacecraft\Lib\Movement\Route\FlightRouteInterface; |
|
16
|
|
|
use Stu\Module\Spacecraft\Lib\SpacecraftWrapperInterface; |
|
17
|
|
|
|
|
18
|
|
|
class AlertStateConsequence extends AbstractFlightConsequence implements FlightStartConsequenceInterface |
|
19
|
|
|
{ |
|
20
|
1 |
|
public function __construct( |
|
21
|
|
|
private ActivatorDeactivatorHelperInterface $activatorDeactivatorHelper, |
|
22
|
|
|
private MessageFactoryInterface $messageFactory |
|
23
|
1 |
|
) {} |
|
24
|
|
|
|
|
25
|
|
|
#[Override] |
|
26
|
|
|
protected function skipWhenTractored(): bool |
|
27
|
|
|
{ |
|
28
|
|
|
return true; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
#[Override] |
|
32
|
|
|
protected function triggerSpecific( |
|
33
|
|
|
SpacecraftWrapperInterface $wrapper, |
|
34
|
|
|
FlightRouteInterface $flightRoute, |
|
35
|
|
|
MessageCollectionInterface $messages |
|
36
|
|
|
): void { |
|
37
|
|
|
|
|
38
|
|
|
if (!$flightRoute->getNextWaypoint()->hasAnomaly(AnomalyTypeEnum::ION_STORM)) { |
|
39
|
|
|
return; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
$spacecraft = $wrapper->get(); |
|
43
|
|
|
$shieldSystem = $spacecraft->getSystems()[SpacecraftSystemTypeEnum::SHIELDS->value] ?? null; |
|
44
|
|
|
|
|
45
|
|
|
if ( |
|
46
|
|
|
$shieldSystem === null |
|
47
|
|
|
|| $shieldSystem->getMode()->isActivated() |
|
48
|
|
|
|| !$spacecraft->getAlertState()->isAtLeast(SpacecraftAlertStateEnum::ALERT_YELLOW) |
|
49
|
|
|
) { |
|
50
|
|
|
return; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
$message = $this->messageFactory->createMessage(); |
|
54
|
|
|
$messages->add($message); |
|
55
|
|
|
|
|
56
|
|
|
$this->activatorDeactivatorHelper->activate($wrapper, SpacecraftSystemTypeEnum::SHIELDS, $message); |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
|
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