|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Stu\Module\Spacecraft\Lib\Interaction; |
|
6
|
|
|
|
|
7
|
|
|
use Override; |
|
|
|
|
|
|
8
|
|
|
use Stu\Component\Ship\Retrofit\CancelRetrofitInterface; |
|
9
|
|
|
use Stu\Component\Spacecraft\Repair\CancelRepairInterface; |
|
10
|
|
|
use Stu\Module\Message\Lib\PrivateMessageFolderTypeEnum; |
|
11
|
|
|
use Stu\Module\Message\Lib\PrivateMessageSenderInterface; |
|
12
|
|
|
use Stu\Orm\Entity\ShipInterface; |
|
13
|
|
|
use Stu\Orm\Entity\StationInterface; |
|
14
|
|
|
use Stu\Orm\Repository\ShipRepositoryInterface; |
|
15
|
|
|
|
|
16
|
|
|
final class ShipUndocking implements ShipUndockingInterface |
|
17
|
|
|
{ |
|
18
|
3 |
|
public function __construct( |
|
19
|
|
|
private ShipRepositoryInterface $shipRepository, |
|
20
|
|
|
private CancelRepairInterface $cancelRepair, |
|
21
|
|
|
private CancelRetrofitInterface $cancelRetrofit, |
|
22
|
|
|
private PrivateMessageSenderInterface $privateMessageSender |
|
23
|
3 |
|
) {} |
|
24
|
|
|
|
|
25
|
|
|
|
|
26
|
1 |
|
#[Override] |
|
27
|
|
|
public function undockShip(StationInterface $station, ShipInterface $dockedShip): void |
|
28
|
|
|
{ |
|
29
|
1 |
|
$this->cancelRepair->cancelRepair($dockedShip); |
|
30
|
1 |
|
$this->cancelRetrofit->cancelRetrofit($dockedShip); |
|
31
|
1 |
|
$dockedShip->setDockedTo(null); |
|
32
|
1 |
|
$this->shipRepository->save($dockedShip); |
|
33
|
|
|
|
|
34
|
1 |
|
$this->privateMessageSender->send( |
|
35
|
1 |
|
$station->getUser()->getId(), |
|
36
|
1 |
|
$dockedShip->getUser()->getId(), |
|
37
|
1 |
|
sprintf( |
|
38
|
1 |
|
'Die %s wurde von der %s abgedockt', |
|
39
|
1 |
|
$dockedShip->getName(), |
|
40
|
1 |
|
$station->getName() |
|
41
|
1 |
|
), |
|
42
|
1 |
|
PrivateMessageFolderTypeEnum::SPECIAL_SHIP, |
|
43
|
1 |
|
$dockedShip->getHref() |
|
44
|
1 |
|
); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
2 |
|
#[Override] |
|
48
|
|
|
public function undockAllDocked(StationInterface $station): bool |
|
49
|
|
|
{ |
|
50
|
2 |
|
$dockedShips = $station->getDockedShips(); |
|
51
|
2 |
|
if ($dockedShips->isEmpty()) { |
|
52
|
1 |
|
return false; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
1 |
|
foreach ($dockedShips as $dockedShip) { |
|
56
|
1 |
|
$this->undockShip($station, $dockedShip); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
1 |
|
$dockedShips->clear(); |
|
60
|
|
|
|
|
61
|
1 |
|
return true; |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|
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