|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Stu\Component\Spacecraft\System\Data; |
|
6
|
|
|
|
|
7
|
|
|
use Override; |
|
|
|
|
|
|
8
|
|
|
use Stu\Component\Spacecraft\System\SpacecraftSystemTypeEnum; |
|
9
|
|
|
use Stu\Module\Template\StatusBarFactoryInterface; |
|
10
|
|
|
use Stu\Orm\Entity\TholianWeb; |
|
11
|
|
|
use Stu\Orm\Repository\SpacecraftSystemRepositoryInterface; |
|
12
|
|
|
use Stu\Orm\Repository\TholianWebRepositoryInterface; |
|
13
|
|
|
|
|
14
|
|
|
class WebEmitterSystemData extends AbstractSystemData |
|
15
|
|
|
{ |
|
16
|
|
|
public ?int $webUnderConstructionId = null; |
|
17
|
|
|
public ?int $ownedWebId = null; |
|
18
|
|
|
|
|
19
|
8 |
|
public function __construct( |
|
20
|
|
|
SpacecraftSystemRepositoryInterface $shipSystemRepository, |
|
21
|
|
|
private TholianWebRepositoryInterface $tholianWebRepository, |
|
22
|
|
|
StatusBarFactoryInterface $statusBarFactory |
|
23
|
|
|
) { |
|
24
|
8 |
|
parent::__construct($shipSystemRepository, $statusBarFactory); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
5 |
|
#[Override] |
|
28
|
|
|
public function getSystemType(): SpacecraftSystemTypeEnum |
|
29
|
|
|
{ |
|
30
|
5 |
|
return SpacecraftSystemTypeEnum::THOLIAN_WEB; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
4 |
|
public function getWebUnderConstruction(): ?TholianWeb |
|
34
|
|
|
{ |
|
35
|
4 |
|
if ($this->webUnderConstructionId === null) { |
|
36
|
4 |
|
return null; |
|
37
|
|
|
} |
|
38
|
2 |
|
return $this->tholianWebRepository->find($this->webUnderConstructionId); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
5 |
|
public function getOwnedTholianWeb(): ?TholianWeb |
|
42
|
|
|
{ |
|
43
|
5 |
|
if ($this->ownedWebId === null) { |
|
44
|
2 |
|
return null; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
3 |
|
return $this->tholianWebRepository->find($this->ownedWebId); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
3 |
|
public function setWebUnderConstructionId(?int $webId): WebEmitterSystemData |
|
51
|
|
|
{ |
|
52
|
3 |
|
$this->webUnderConstructionId = $webId; |
|
53
|
3 |
|
return $this; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
3 |
|
public function setOwnedWebId(?int $webId): WebEmitterSystemData |
|
57
|
|
|
{ |
|
58
|
3 |
|
$this->ownedWebId = $webId; |
|
59
|
3 |
|
return $this; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
1 |
|
public function getCooldown(): ?int |
|
63
|
|
|
{ |
|
64
|
1 |
|
return $this->spacecraft->getSpacecraftSystem(SpacecraftSystemTypeEnum::THOLIAN_WEB)->getCooldown(); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
1 |
|
public function isUseable(): bool |
|
68
|
|
|
{ |
|
69
|
1 |
|
if ($this->webUnderConstructionId !== null) { |
|
70
|
|
|
return false; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
1 |
|
$cooldown = $this->getCooldown(); |
|
74
|
|
|
|
|
75
|
1 |
|
return $cooldown === null ? true : $cooldown < time(); |
|
76
|
|
|
} |
|
77
|
|
|
} |
|
78
|
|
|
|
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