|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Stu\Module\Station\Lib; |
|
6
|
|
|
|
|
7
|
|
|
use Override; |
|
|
|
|
|
|
8
|
|
|
use RuntimeException; |
|
9
|
|
|
use Stu\Module\Spacecraft\Lib\SourceAndTargetWrappersInterface; |
|
10
|
|
|
use Stu\Module\Spacecraft\Lib\SpacecraftLoaderInterface; |
|
11
|
|
|
use Stu\Orm\Entity\StationInterface; |
|
12
|
|
|
use Stu\Orm\Entity\SpacecraftInterface; |
|
13
|
|
|
|
|
14
|
|
|
final class StationLoader implements StationLoaderInterface |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* @param SpacecraftLoaderInterface<StationWrapperInterface> $spacecraftLoader |
|
18
|
|
|
*/ |
|
19
|
1 |
|
public function __construct( |
|
20
|
|
|
private SpacecraftLoaderInterface $spacecraftLoader |
|
21
|
1 |
|
) {} |
|
22
|
|
|
|
|
23
|
5 |
|
#[Override] |
|
24
|
|
|
public function getByIdAndUser( |
|
25
|
|
|
int $stationId, |
|
26
|
|
|
int $userId, |
|
27
|
|
|
bool $allowUplink = false, |
|
28
|
|
|
bool $checkForEntityLock = true |
|
29
|
|
|
): StationInterface { |
|
30
|
|
|
|
|
31
|
5 |
|
$spacecraft = $this->spacecraftLoader->getByIdAndUser( |
|
32
|
5 |
|
$stationId, |
|
33
|
5 |
|
$userId, |
|
34
|
5 |
|
$allowUplink, |
|
35
|
5 |
|
$checkForEntityLock |
|
36
|
5 |
|
); |
|
37
|
|
|
|
|
38
|
5 |
|
if (!$spacecraft instanceof StationInterface) { |
|
39
|
|
|
throw new RuntimeException(sprintf('stationId %d is not a station', $stationId)); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
5 |
|
return $spacecraft; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
1 |
|
#[Override] |
|
46
|
|
|
public function getWrapperByIdAndUser( |
|
47
|
|
|
int $stationId, |
|
48
|
|
|
int $userId, |
|
49
|
|
|
bool $allowUplink = false, |
|
50
|
|
|
bool $checkForEntityLock = true |
|
51
|
|
|
): StationWrapperInterface { |
|
52
|
|
|
|
|
53
|
1 |
|
$wrapper = $this->spacecraftLoader->getWrapperByIdAndUser( |
|
54
|
1 |
|
$stationId, |
|
55
|
1 |
|
$userId, |
|
56
|
1 |
|
$allowUplink, |
|
57
|
1 |
|
$checkForEntityLock |
|
58
|
1 |
|
); |
|
59
|
|
|
|
|
60
|
1 |
|
if (!$wrapper instanceof StationWrapperInterface) { |
|
61
|
|
|
throw new RuntimeException(sprintf('stationId %d is not a station', $stationId)); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
1 |
|
return $wrapper; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
#[Override] |
|
68
|
|
|
public function getWrappersBySourceAndUserAndTarget( |
|
69
|
|
|
int $stationId, |
|
70
|
|
|
int $userId, |
|
71
|
|
|
int $targetId, |
|
72
|
|
|
bool $allowUplink = false, |
|
73
|
|
|
bool $checkForEntityLock = true |
|
74
|
|
|
): SourceAndTargetWrappersInterface { |
|
75
|
|
|
|
|
76
|
|
|
return $this->spacecraftLoader->getWrappersBySourceAndUserAndTarget( |
|
77
|
|
|
$stationId, |
|
78
|
|
|
$userId, |
|
79
|
|
|
$targetId, |
|
80
|
|
|
$allowUplink, |
|
81
|
|
|
$checkForEntityLock |
|
82
|
|
|
); |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
#[Override] |
|
86
|
|
|
public function find(int $stationId, bool $checkForEntityLock = true): ?StationWrapperInterface |
|
87
|
|
|
{ |
|
88
|
|
|
$wrapper = $this->spacecraftLoader->find( |
|
89
|
|
|
$stationId, |
|
90
|
|
|
$checkForEntityLock |
|
91
|
|
|
); |
|
92
|
|
|
|
|
93
|
|
|
if ($wrapper !== null && !$wrapper instanceof StationWrapperInterface) { |
|
94
|
|
|
throw new RuntimeException(sprintf('stationId %d is not a station', $stationId)); |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
return $wrapper; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
public function save(SpacecraftInterface $station): void |
|
101
|
|
|
{ |
|
102
|
|
|
$this->spacecraftLoader->save($station); |
|
103
|
|
|
} |
|
104
|
|
|
} |
|
105
|
|
|
|
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