|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Stu\Component\Crew\Skill; |
|
6
|
|
|
|
|
7
|
|
|
use Stu\Module\Control\StuTime; |
|
8
|
|
|
use Stu\Orm\Entity\CrewSkillInterface; |
|
9
|
|
|
use Stu\Orm\Entity\SkillEnhancementInterface; |
|
10
|
|
|
use Stu\Orm\Repository\SkillEnhancementLogRepositoryInterface; |
|
11
|
|
|
|
|
12
|
|
|
class CreateEnhancementLog |
|
13
|
|
|
{ |
|
14
|
3 |
|
public function __construct( |
|
15
|
|
|
private SkillEnhancementLogRepositoryInterface $skillEnhancementLogRepository, |
|
16
|
|
|
private StuTime $stuTime |
|
17
|
3 |
|
) {} |
|
18
|
|
|
|
|
19
|
2 |
|
public function createEnhancementLog( |
|
20
|
|
|
CrewSkillInterface $crewSkill, |
|
21
|
|
|
string $spacecraftName, |
|
22
|
|
|
SkillEnhancementInterface $enhancement, |
|
23
|
|
|
int $amount, |
|
24
|
|
|
CrewSkillLevelEnum $oldRank |
|
|
|
|
|
|
25
|
|
|
): void { |
|
26
|
|
|
|
|
27
|
2 |
|
$crew = $crewSkill->getCrew(); |
|
28
|
|
|
|
|
29
|
2 |
|
$log = $this->skillEnhancementLogRepository |
|
30
|
2 |
|
->prototype() |
|
31
|
2 |
|
->setUser($crew->getUser()) |
|
32
|
2 |
|
->setEnhancement($enhancement) |
|
33
|
2 |
|
->setCrewName($crew->getName()) |
|
34
|
2 |
|
->setShipName($spacecraftName) |
|
35
|
2 |
|
->setCrewId($crew->getId()) |
|
36
|
2 |
|
->setExpertise($amount) |
|
37
|
2 |
|
->setExpertiseSum($crewSkill->getExpertise()) |
|
38
|
2 |
|
->setPromotion($this->getPromotion($oldRank, $crewSkill->getRank())) |
|
39
|
2 |
|
->setTimestamp($this->stuTime->time()); |
|
40
|
|
|
|
|
41
|
2 |
|
$this->skillEnhancementLogRepository->save($log); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
2 |
|
private function getPromotion(CrewSkillLevelEnum $oldRank, CrewSkillLevelEnum $newRank): ?string |
|
45
|
|
|
{ |
|
46
|
2 |
|
return $oldRank !== $newRank |
|
47
|
1 |
|
? sprintf('Beförderung %s -> %s', $oldRank->getDescription(), $newRank->getDescription()) |
|
48
|
2 |
|
: null; |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|
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