Skip to content

Commit 245a0d4

Browse files
committed
code optimization
1 parent ca533f8 commit 245a0d4

File tree

11 files changed

+15
-42
lines changed

11 files changed

+15
-42
lines changed

src/Module/Database/View/DatabaseEntry/DatabaseEntry.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public function getColonyScanList(UserInterface $user, int $systemId): array
263263

264264
$filteredScans = array_filter(
265265
$unfilteredScans,
266-
fn(ColonyScanInterface $scan): bool => $scan->getColony()->getSystemsId() === $systemId
266+
fn(ColonyScanInterface $scan): bool => $scan->getColony()->getSystem()->getId() === $systemId
267267
);
268268

269269
$scansByColony = [];
@@ -283,4 +283,4 @@ public function getColonyScanList(UserInterface $user, int $systemId): array
283283

284284
return $latestScans;
285285
}
286-
}
286+
}

src/Orm/Entity/Colony.php

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -162,34 +162,12 @@ public function getSy(): int
162162
return $this->getStarsystemMap()->getSy();
163163
}
164164

165-
#[Override]
166-
public function getSystemsId(): int
167-
{
168-
return $this->getSystem()->getId();
169-
}
170-
171165
#[Override]
172166
public function getName(): string
173167
{
174168
return $this->name;
175169
}
176170

177-
#[Override]
178-
public function getNameAndSectorString(): string
179-
{
180-
return sprintf(
181-
'%s %s',
182-
$this->getName(),
183-
$this->getSectorString()
184-
);
185-
}
186-
187-
#[Override]
188-
public function getSystemString(): string
189-
{
190-
return sprintf('%s-System (%s|%s)', $this->getSystem()->getName(), $this->getSystem()->getCx(), $this->getSystem()->getCy());
191-
}
192-
193171
#[Override]
194172
public function setName(string $name): ColonyInterface
195173
{
@@ -236,8 +214,7 @@ public function setDatabaseEntry(?DatabaseEntryInterface $entry): ColonyInterfac
236214
return $this;
237215
}
238216

239-
#[Override]
240-
public function getRotationFactor(): int
217+
private function getRotationFactor(): int
241218
{
242219
return $this->rotation_factor;
243220
}

src/Orm/Entity/ColonyInterface.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ public function getSx(): int;
2424

2525
public function getSy(): int;
2626

27-
public function getSystemsId(): int;
28-
29-
public function getNameAndSectorString(): string;
30-
31-
public function getSystemString(): string;
32-
3327
public function setName(string $name): ColonyInterface;
3428

3529
public function getPlanetName(): string;
@@ -46,8 +40,6 @@ public function setDatabaseEntry(?DatabaseEntryInterface $entry): ColonyInterfac
4640

4741
public function getTwilightZone(int $timestamp): int;
4842

49-
public function getRotationFactor(): int;
50-
5143
public function setRotationFactor(int $rotationFactor): ColonyInterface;
5244

5345
public function getRotationTime(): int;

src/html/alliance/alliancemanagement.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<td>
3737
{% for col in data.getColonies %}
3838
<img src="assets/planets/{{ col.getColonyClass.getId }}.png"
39-
title="{{ col.getNameAndSectorString|bbcode2txt }}" />
39+
title="{{ col.getName|bbcode2txt }} {{ col.getSectorString }}" />
4040
{% endfor %}
4141
</td>
4242
<td>

src/html/colony/sandbox/newSandbox.twig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
<td>
88
<select id="colony-id">
99
{% for colony in SANDBOX_LIST %}
10-
<option value="{{ colony.getId }}">{{ colony.getNameAndSectorString|bbcode2txt }}</option>
10+
<option value="{{ colony.getId }}">{{ colony.getName|bbcode2txt }} {{ colony.getSectorString }}
11+
</option>
1112
{% endfor %}
1213
</select>
1314
</td>

src/html/game/component/coloniesComponent.twig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
{% set colonyClass = colony.getColonyClass %}
66
{% set colonyClassId = colonyClass.getId %}
77
{% set title = colony.getName|bbcode2txt %}
8+
{% set system = colony.getSystem %}
9+
{% set systemString = system.getName ~ '-System ('~ system.getCx ~'|'~ system.getCy ~')' %}
810
{% set overlibText = "<table class='tcal'>
911
<tr>
1012
<th>Kolonieinformationen: " ~ title ~ "</th>
1113
</tr>
1214
<tr>
13-
<td>Koordinaten: " ~ colony.getSx ~ "|" ~ colony.getSy ~ "<br>System: " ~ colony.getSystemString|bbcode2txt
15+
<td>Koordinaten: " ~ colony.getSx ~ "|" ~ colony.getSy ~ "<br>System: " ~ systemString|bbcode2txt
1416
~ "<br>EPS: " ~ colony.getChangeable.getEps ~ "/" ~ colony.getMaxEps ~ "<br>Lager: " ~
1517
colony.getStorageSum ~ "/" ~ colony.getMaxStorage ~ "</td>
1618
</tr>

tests/inttest/html/Game/__snapshots__/ShowComponentTest__testHandle with data set 0__1.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<body>
55
<div class="header_box header_box_col border_box">
6-
6+
77
<a href="/colony.php?SHOW_COLONY=1&amp;id=42" onclick="if(event.button === 0) { switchInnerContent('SHOW_COLONY', 'Stempor&amp;#039;Arr 4', 'id=42', '/colony.php'); event.preventDefault(); }" style="margin: 7px 5px 7px 5px; text-align: center; float: left" class="action" onmouseover="return overlib('\u003Ctable\u0020class\u003D\u0027tcal\u0027\u003E\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u003Ctr\u003E\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u003Cth\u003EKolonieinformationen\u003A\u0020Stempor\u0027Arr\u00204\u003C\/th\u003E\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u003C\/tr\u003E\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u003Ctr\u003E\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u003Ctd\u003EKoordinaten\u003A\u00207\u007C11\u003Cbr\u003ESystem\u003A\u0020Stempor\u0027Arr\u002DSystem\u0020\u00287\u007C8\u0029\u003Cbr\u003EEPS\u003A\u002096\/96\u003Cbr\u003ELager\u003A\u0020701\/1000\u003C\/td\u003E\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u003C\/tr\u003E\n\u0020\u0020\u0020\u0020\u003C\/table\u003E', CAPTION, '', CLOSETEXT, 'X', CLOSECOLOR, '#8897cf', TEXTCOLOR, '#000000', CELLPAD, 4);" onmouseout="return nd();">
88
<img src="/assets/planets/201.png">
99
</a>

tests/inttest/html/Spacecraft/__snapshots__/ShowShipTest__testHandle__1.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
<div id="GAME_COLONIES_NAVLET">
120120

121121
<div class="header_box header_box_col border_box">
122-
122+
123123
<a href="/colony.php?SHOW_COLONY=1&amp;id=42" onclick="if(event.button === 0) { switchInnerContent('SHOW_COLONY', 'Stempor&amp;#039;Arr 4', 'id=42', '/colony.php'); event.preventDefault(); }" style="margin: 7px 5px 7px 5px; text-align: center; float: left" class="action" onmouseover="return overlib('\u003Ctable\u0020class\u003D\u0027tcal\u0027\u003E\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u003Ctr\u003E\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u003Cth\u003EKolonieinformationen\u003A\u0020Stempor\u0027Arr\u00204\u003C\/th\u003E\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u003C\/tr\u003E\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u003Ctr\u003E\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u003Ctd\u003EKoordinaten\u003A\u00207\u007C11\u003Cbr\u003ESystem\u003A\u0020Stempor\u0027Arr\u002DSystem\u0020\u00287\u007C8\u0029\u003Cbr\u003EEPS\u003A\u002096\/96\u003Cbr\u003ELager\u003A\u0020701\/1000\u003C\/td\u003E\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u003C\/tr\u003E\n\u0020\u0020\u0020\u0020\u003C\/table\u003E', CAPTION, '', CLOSETEXT, 'X', CLOSECOLOR, '#8897cf', TEXTCOLOR, '#000000', CELLPAD, 4);" onmouseout="return nd();">
124124
<img src="/assets/planets/201.png">
125125
</a>

tests/inttest/html/Spacecraft/__snapshots__/ShowStationTest__testHandle__1.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
<div id="GAME_COLONIES_NAVLET">
120120

121121
<div class="header_box header_box_col border_box">
122-
122+
123123
<a href="/colony.php?SHOW_COLONY=1&amp;id=42" onclick="if(event.button === 0) { switchInnerContent('SHOW_COLONY', 'Stempor&amp;#039;Arr 4', 'id=42', '/colony.php'); event.preventDefault(); }" style="margin: 7px 5px 7px 5px; text-align: center; float: left" class="action" onmouseover="return overlib('\u003Ctable\u0020class\u003D\u0027tcal\u0027\u003E\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u003Ctr\u003E\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u003Cth\u003EKolonieinformationen\u003A\u0020Stempor\u0027Arr\u00204\u003C\/th\u003E\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u003C\/tr\u003E\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u003Ctr\u003E\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u003Ctd\u003EKoordinaten\u003A\u00207\u007C11\u003Cbr\u003ESystem\u003A\u0020Stempor\u0027Arr\u002DSystem\u0020\u00287\u007C8\u0029\u003Cbr\u003EEPS\u003A\u002096\/96\u003Cbr\u003ELager\u003A\u0020701\/1000\u003C\/td\u003E\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u003C\/tr\u003E\n\u0020\u0020\u0020\u0020\u003C\/table\u003E', CAPTION, '', CLOSETEXT, 'X', CLOSECOLOR, '#8897cf', TEXTCOLOR, '#000000', CELLPAD, 4);" onmouseout="return nd();">
124124
<img src="/assets/planets/201.png">
125125
</a>

tests/inttest/html/__snapshots__/AllViewControllerTest--COLONY_VIEWS-SHOW_NEW_SANDBOX.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
<th>Sandbox f&Atilde;&frac14;r folgende Kolonie</th>
2424
<td>
2525
<select id="colony-id">
26-
<option value="42">Stempor'Arr 4 7|11 (Stempor'Arr-System)</option>
26+
<option value="42">Stempor'Arr 4 7|11 (Stempor'Arr-System)
27+
</option>
2728
</select>
2829
</td>
2930
</tr>

0 commit comments

Comments
 (0)