Total Complexity | 7 |
Total Lines | 62 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | abstract class AbstractReactorSystemData extends AbstractSystemData |
||
11 | { |
||
12 | public int $output = 0; |
||
13 | public int $load = 0; |
||
14 | |||
15 | private ShipSystemRepositoryInterface $shipSystemRepository; |
||
16 | |||
17 | public function __construct(ShipSystemRepositoryInterface $shipSystemRepository) |
||
18 | { |
||
19 | $this->shipSystemRepository = $shipSystemRepository; |
||
20 | } |
||
21 | |||
22 | public function update(): void |
||
23 | { |
||
24 | $this->updateSystemData( |
||
25 | $this->getSystemType(), |
||
26 | $this, |
||
27 | $this->shipSystemRepository |
||
28 | ); |
||
29 | } |
||
30 | |||
31 | abstract function getSystemType(): ShipSystemTypeEnum; |
||
|
|||
32 | |||
33 | public abstract function getIcon(): string; |
||
34 | |||
35 | public abstract function getLoadUnits(): int; |
||
36 | |||
37 | /** @return array<int, int> */ |
||
38 | public abstract function getLoadCost(): array; |
||
39 | |||
40 | public abstract function getCapacity(): int; |
||
41 | |||
42 | /** |
||
43 | * proportional to reactor system status |
||
44 | */ |
||
45 | public function getOutput(): int |
||
46 | { |
||
47 | return (int) (ceil($this->output |
||
48 | * $this->ship->getShipSystem($this->getSystemType())->getStatus() / 100)); |
||
49 | } |
||
50 | |||
51 | public function getTheoreticalReactorOutput(): int |
||
52 | { |
||
53 | return $this->output; |
||
54 | } |
||
55 | |||
56 | public function setOutput(int $output): AbstractReactorSystemData |
||
60 | } |
||
61 | |||
62 | public function getLoad(): int |
||
63 | { |
||
64 | return $this->load; |
||
65 | } |
||
66 | |||
67 | public function setLoad(int $load): AbstractReactorSystemData |
||
72 | } |
||
73 | } |
||
74 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.