1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Stu\Module\Spacecraft\Lib\Auxiliary; |
6
|
|
|
|
7
|
|
|
use Override; |
|
|
|
|
8
|
|
|
use Stu\Component\Spacecraft\SpacecraftStateEnum; |
9
|
|
|
use Stu\Component\Spacecraft\System\SpacecraftSystemManagerInterface; |
10
|
|
|
use Stu\Module\Ship\Lib\Fleet\LeaveFleetInterface; |
11
|
|
|
use Stu\Module\Spacecraft\Lib\Interaction\ShipUndockingInterface; |
12
|
|
|
use Stu\Module\Spacecraft\Lib\SpacecraftStateChangerInterface; |
13
|
|
|
use Stu\Module\Spacecraft\Lib\SpacecraftWrapperInterface; |
14
|
|
|
use Stu\Orm\Entity\ShipInterface; |
15
|
|
|
use Stu\Orm\Entity\StationInterface; |
16
|
|
|
use Stu\Orm\Repository\SpacecraftRepositoryInterface; |
17
|
|
|
|
18
|
|
|
final class SpacecraftShutdown implements SpacecraftShutdownInterface |
19
|
|
|
{ |
20
|
8 |
|
public function __construct( |
21
|
|
|
private SpacecraftRepositoryInterface $spacecraftRepository, |
22
|
|
|
private SpacecraftSystemManagerInterface $spacecraftSystemManager, |
23
|
|
|
private LeaveFleetInterface $leaveFleet, |
24
|
|
|
private SpacecraftStateChangerInterface $spacecraftStateChanger, |
25
|
|
|
private ShipUndockingInterface $shipUndocking |
26
|
8 |
|
) {} |
27
|
|
|
|
28
|
7 |
|
#[Override] |
29
|
|
|
public function shutdown(SpacecraftWrapperInterface $wrapper, bool $doLeaveFleet = false): void |
30
|
|
|
{ |
31
|
7 |
|
$this->spacecraftSystemManager->deactivateAll($wrapper); |
32
|
|
|
|
33
|
7 |
|
$spacecraft = $wrapper->get(); |
34
|
|
|
|
35
|
7 |
|
if ($doLeaveFleet && $spacecraft instanceof ShipInterface) { |
36
|
1 |
|
$this->leaveFleet->leaveFleet($spacecraft); |
37
|
|
|
} |
38
|
7 |
|
if ($spacecraft instanceof StationInterface) { |
39
|
4 |
|
$this->shipUndocking->undockAllDocked($spacecraft); |
40
|
|
|
} |
41
|
7 |
|
if ($spacecraft->getState()->isActiveState()) { |
42
|
6 |
|
$this->spacecraftStateChanger->changeState($wrapper, SpacecraftStateEnum::NONE); |
43
|
|
|
} |
44
|
|
|
|
45
|
7 |
|
$spacecraft->setAlertStateGreen(); |
46
|
7 |
|
$this->spacecraftRepository->save($spacecraft); |
47
|
|
|
} |
48
|
|
|
} |
49
|
|
|
|
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