|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Stu\Module\Ship\Lib\Destruction\Handler; |
|
4
|
|
|
|
|
5
|
|
|
use Stu\Component\Ship\System\ShipSystemManagerInterface; |
|
6
|
|
|
use Stu\Component\Ship\System\ShipSystemTypeEnum; |
|
7
|
|
|
use Stu\Lib\Information\InformationInterface; |
|
8
|
|
|
use Stu\Module\Ship\Lib\Destruction\ShipDestroyerInterface; |
|
9
|
|
|
use Stu\Module\Ship\Lib\Destruction\ShipDestructionCauseEnum; |
|
10
|
|
|
use Stu\Module\Ship\Lib\ShipWrapperFactoryInterface; |
|
11
|
|
|
use Stu\Module\Ship\Lib\ShipWrapperInterface; |
|
12
|
|
|
use Stu\Orm\Repository\ShipSystemRepositoryInterface; |
|
13
|
|
|
|
|
14
|
|
|
class ResetTrackerDevices implements ShipDestructionHandlerInterface |
|
15
|
|
|
{ |
|
16
|
1 |
|
public function __construct( |
|
17
|
|
|
private ShipSystemRepositoryInterface $shipSystemRepository, |
|
18
|
|
|
private ShipSystemManagerInterface $shipSystemManager, |
|
19
|
|
|
private ShipWrapperFactoryInterface $shipWrapperFactory |
|
20
|
|
|
) { |
|
21
|
1 |
|
} |
|
22
|
|
|
|
|
23
|
|
|
public function handleShipDestruction( |
|
24
|
|
|
?ShipDestroyerInterface $destroyer, |
|
25
|
|
|
ShipWrapperInterface $destroyedShipWrapper, |
|
26
|
|
|
ShipDestructionCauseEnum $cause, |
|
27
|
|
|
InformationInterface $informations |
|
28
|
|
|
): void { |
|
29
|
|
|
|
|
30
|
|
|
$shipId = $destroyedShipWrapper->get()->getId(); |
|
31
|
|
|
|
|
32
|
|
|
foreach ($this->shipSystemRepository->getTrackingShipSystems($shipId) as $system) { |
|
33
|
|
|
$wrapper = $this->shipWrapperFactory->wrapShip($system->getShip()); |
|
34
|
|
|
|
|
35
|
|
|
$this->shipSystemManager->deactivate($wrapper, ShipSystemTypeEnum::SYSTEM_TRACKER, true); |
|
36
|
|
|
} |
|
37
|
|
|
} |
|
38
|
|
|
} |
|
39
|
|
|
|