| Total Complexity | 4 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Coverage | 28.57% |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | abstract class AbstractSystemData |
||
| 14 | { |
||
| 15 | protected ShipInterface $ship; |
||
| 16 | |||
| 17 | 5 | public function __construct(private ShipSystemRepositoryInterface $shipSystemRepository) |
|
| 18 | { |
||
| 19 | 5 | } |
|
| 20 | |||
| 21 | 3 | public function setShip(ShipInterface $ship): void |
|
| 24 | } |
||
| 25 | |||
| 26 | abstract public function getSystemType(): ShipSystemTypeEnum; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * updates the system metadata for this specific ship system |
||
| 30 | */ |
||
| 31 | public function update(): void |
||
| 32 | { |
||
| 33 | $system = $this->ship->getShipSystem($this->getSystemType()); |
||
| 34 | $system->setData(json_encode($this, JSON_THROW_ON_ERROR)); |
||
| 35 | $this->shipSystemRepository->save($system); |
||
| 36 | } |
||
| 37 | |||
| 38 | protected function getTalStatusBar(string $label, int $value, int $maxValue, string $color): TalStatusBarInterface |
||
| 45 | } |
||
| 46 | } |
||
| 47 |