|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Stu\Module\Tick\Process; |
|
6
|
|
|
|
|
7
|
|
|
use Stu\Component\Spacecraft\Repair\RepairUtilInterface; |
|
8
|
|
|
use Stu\Module\Message\Lib\PrivateMessageFolderTypeEnum; |
|
9
|
|
|
use Stu\Module\Message\Lib\PrivateMessageSenderInterface; |
|
10
|
|
|
use Stu\Module\PlayerSetting\Lib\UserConstants; |
|
|
|
|
|
|
11
|
|
|
use Stu\Orm\Repository\RepairTaskRepositoryInterface; |
|
12
|
|
|
|
|
13
|
|
|
final class RepairTaskJobs implements ProcessTickHandlerInterface |
|
14
|
|
|
{ |
|
15
|
1 |
|
public function __construct( |
|
16
|
|
|
private RepairTaskRepositoryInterface $repairTaskRepository, |
|
17
|
|
|
private RepairUtilInterface $repairUtil, |
|
18
|
|
|
private PrivateMessageSenderInterface $privateMessageSender |
|
19
|
1 |
|
) {} |
|
20
|
|
|
|
|
21
|
1 |
|
#[\Override] |
|
22
|
|
|
public function work(): void |
|
23
|
|
|
{ |
|
24
|
1 |
|
$result = $this->repairTaskRepository->getFinishedRepairTasks(); |
|
25
|
1 |
|
foreach ($result as $repairTask) { |
|
26
|
|
|
$spacecraft = $repairTask->getSpacecraft(); |
|
27
|
|
|
|
|
28
|
|
|
if (!$spacecraft->hasEnoughCrew()) { |
|
29
|
|
|
$this->privateMessageSender->send( |
|
30
|
|
|
UserConstants::USER_NOONE, |
|
31
|
|
|
$spacecraft->getUser()->getId(), |
|
32
|
|
|
sprintf( |
|
33
|
|
|
_('Ungenügend Crew auf der %s vorhanden, daher wurde die Reparatur des Systems %s abgebrochen'), |
|
34
|
|
|
$spacecraft->getName(), |
|
35
|
|
|
$repairTask->getSystemType()->getDescription() |
|
36
|
|
|
), |
|
37
|
|
|
PrivateMessageFolderTypeEnum::SPECIAL_SHIP, |
|
38
|
|
|
$spacecraft |
|
39
|
|
|
); |
|
40
|
|
|
|
|
41
|
|
|
$this->repairTaskRepository->delete($repairTask); |
|
42
|
|
|
|
|
43
|
|
|
continue; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
$isSuccess = $this->repairUtil->selfRepair($spacecraft, $repairTask); |
|
47
|
|
|
|
|
48
|
|
|
if ($isSuccess) { |
|
49
|
|
|
$msg = sprintf( |
|
50
|
|
|
_('Die Crew der %s hat das System %s auf %d %% reparieren können'), |
|
51
|
|
|
$spacecraft->getName(), |
|
52
|
|
|
$repairTask->getSystemType()->getDescription(), |
|
53
|
|
|
$repairTask->getHealingPercentage() |
|
54
|
|
|
); |
|
55
|
|
|
} else { |
|
56
|
|
|
$msg = sprintf( |
|
57
|
|
|
_('Der Reparaturversuch des Systems %s an Bord der %s brachte keine Besserung'), |
|
58
|
|
|
$repairTask->getSystemType()->getDescription(), |
|
59
|
|
|
$spacecraft->getName() |
|
60
|
|
|
); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
$this->privateMessageSender->send( |
|
64
|
|
|
UserConstants::USER_NOONE, |
|
65
|
|
|
$spacecraft->getUser()->getId(), |
|
66
|
|
|
$msg, |
|
67
|
|
|
PrivateMessageFolderTypeEnum::SPECIAL_SHIP, |
|
68
|
|
|
$spacecraft |
|
69
|
|
|
); |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|
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