Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Failed Conditions
Pull Request — master (#1018)
by Dan
04:32
created
src/lib/Default/SmrPlanetType.class.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
 			'exp_gain' => 540,
80 80
 		],
81 81
 	];
82
-	public function name()         { return "Terran Planet"; }
83
-	public function imageLink()    { return "images/planet1.png"; }
84
-	public function description()  { return "A lush world, with forests, seas, sweeping meadows, and indigenous lifeforms."; }
82
+	public function name() { return "Terran Planet"; }
83
+	public function imageLink() { return "images/planet1.png"; }
84
+	public function description() { return "A lush world, with forests, seas, sweeping meadows, and indigenous lifeforms."; }
85 85
 	public function maxAttackers() { return 10; }
86
-	public function maxLanded()    { return self::MAX_LANDED_UNLIMITED; }
87
-	public function menuOptions()  { return self::DEFAULT_MENU_OPTIONS; }
86
+	public function maxLanded() { return self::MAX_LANDED_UNLIMITED; }
87
+	public function menuOptions() { return self::DEFAULT_MENU_OPTIONS; }
88 88
 }
89 89
 
90 90
 class AridPlanet extends SmrPlanetType {
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
 			'exp_gain' => 180,
109 109
 		],
110 110
 	];
111
-	public function name()         { return "Arid Planet"; }
112
-	public function imageLink()    { return "images/planet2.png"; }
113
-	public function description()  { return "A world mostly devoid of surface water, but capable of supporting life."; }
111
+	public function name() { return "Arid Planet"; }
112
+	public function imageLink() { return "images/planet2.png"; }
113
+	public function description() { return "A world mostly devoid of surface water, but capable of supporting life."; }
114 114
 	public function maxAttackers() { return 5; }
115
-	public function maxLanded()    { return 5; }
116
-	public function menuOptions()  { return ['CONSTRUCTION', 'DEFENSE', 'STOCKPILE', 'OWNERSHIP']; }
115
+	public function maxLanded() { return 5; }
116
+	public function menuOptions() { return ['CONSTRUCTION', 'DEFENSE', 'STOCKPILE', 'OWNERSHIP']; }
117 117
 }
118 118
 
119 119
 class DwarfPlanet extends SmrPlanetType {
@@ -137,12 +137,12 @@  discard block
 block discarded – undo
137 137
 			'exp_gain' => 540,
138 138
 		],
139 139
 	];
140
-	public function name()         { return "Dwarf Planet"; }
141
-	public function imageLink()    { return "images/planet3.png"; }
142
-	public function description()  { return "A smaller than usual planet, with no native life present."; }
140
+	public function name() { return "Dwarf Planet"; }
141
+	public function imageLink() { return "images/planet3.png"; }
142
+	public function description() { return "A smaller than usual planet, with no native life present."; }
143 143
 	public function maxAttackers() { return 5; }
144
-	public function maxLanded()    { return self::MAX_LANDED_UNLIMITED; }
145
-	public function menuOptions()  { return self::DEFAULT_MENU_OPTIONS; }
144
+	public function maxLanded() { return self::MAX_LANDED_UNLIMITED; }
145
+	public function menuOptions() { return self::DEFAULT_MENU_OPTIONS; }
146 146
 }
147 147
 
148 148
 class ProtoPlanet extends SmrPlanetType {
@@ -178,12 +178,12 @@  discard block
 block discarded – undo
178 178
 			'exp_gain' => 540,
179 179
 		],
180 180
 	];
181
-	public function name()         { return "Protoplanet"; }
182
-	public function imageLink()    { return "images/planet5.png"; }
183
-	public function description()  { return "A developing planet, not yet able to support the infrastructure of advanced technologies."; }
181
+	public function name() { return "Protoplanet"; }
182
+	public function imageLink() { return "images/planet5.png"; }
183
+	public function description() { return "A developing planet, not yet able to support the infrastructure of advanced technologies."; }
184 184
 	public function maxAttackers() { return 5; }
185
-	public function maxLanded()    { return 5; }
186
-	public function menuOptions()  { return self::DEFAULT_MENU_OPTIONS; }
185
+	public function maxLanded() { return 5; }
186
+	public function menuOptions() { return self::DEFAULT_MENU_OPTIONS; }
187 187
 }
188 188
 
189 189
 class DefenseWorld extends SmrPlanetType {
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
 			'exp_gain' => 9,
214 214
 		],
215 215
 	];
216
-	public function name()         { return "Defense World"; }
217
-	public function imageLink()    { return "images/planet4.png"; }
218
-	public function description()  { return "A fully armed and operational battle station loaded with excessive firepower."; }
216
+	public function name() { return "Defense World"; }
217
+	public function imageLink() { return "images/planet4.png"; }
218
+	public function description() { return "A fully armed and operational battle station loaded with excessive firepower."; }
219 219
 	public function maxAttackers() { return 10; }
220
-	public function maxLanded()    { return self::MAX_LANDED_UNLIMITED; }
221
-	public function menuOptions()  { return self::DEFAULT_MENU_OPTIONS; }
220
+	public function maxLanded() { return self::MAX_LANDED_UNLIMITED; }
221
+	public function menuOptions() { return self::DEFAULT_MENU_OPTIONS; }
222 222
 }
Please login to merge, or discard this patch.
src/lib/Default/DummyPlayer.class.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,30 +1,30 @@  discard block
 block discarded – undo
1 1
 <?php declare(strict_types=1);
2 2
 
3 3
 class DummyPlayer extends AbstractSmrPlayer {
4
-	public function __construct($gameID=0,$playerName='Dummy',$raceID=1,$experience=1000,$alignment=100,$allianceID=0,$shipTypeID=60) {
4
+	public function __construct($gameID = 0, $playerName = 'Dummy', $raceID = 1, $experience = 1000, $alignment = 100, $allianceID = 0, $shipTypeID = 60) {
5 5
 		$this->accountID				= 0;
6
-		$this->gameID					= (int) $gameID;
7
-		$this->playerName				= (string) $playerName;
6
+		$this->gameID = (int)$gameID;
7
+		$this->playerName = (string)$playerName;
8 8
 		$this->playerID					= 0;
9 9
 		$this->sectorID					= 0;
10
-		$this->lastSectorID				= 0;
10
+		$this->lastSectorID = 0;
11 11
 		$this->turns					= 1000;
12
-		$this->newbieTurns				= 0;
12
+		$this->newbieTurns = 0;
13 13
 		$this->lastNewsUpdate			= 0;
14 14
 		$this->dead						= false;
15 15
 		$this->landedOnPlanet			= false;
16
-		$this->lastActive				= 0;
17
-		$this->lastCPLAction			= 0;
18
-		$this->raceID					= (int) $raceID;
19
-		$this->credits					= 0;
20
-		$this->experience				= (int) $experience;
21
-		$this->alignment				= (int) $alignment;
22
-		$this->militaryPayment			= 0;
23
-		$this->allianceID				= (int) $allianceID;
24
-		$this->shipID					= (int) $shipTypeID;
16
+		$this->lastActive = 0;
17
+		$this->lastCPLAction = 0;
18
+		$this->raceID = (int)$raceID;
19
+		$this->credits = 0;
20
+		$this->experience				= (int)$experience;
21
+		$this->alignment = (int)$alignment;
22
+		$this->militaryPayment = 0;
23
+		$this->allianceID				= (int)$allianceID;
24
+		$this->shipID					= (int)$shipTypeID;
25 25
 		$this->kills					= 0;
26 26
 		$this->deaths					= 0;
27
-		$this->lastPort					= 0;
27
+		$this->lastPort = 0;
28 28
 		$this->bank						= 0;
29 29
 		$this->zoom						= 0;
30 30
 
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	}
49 49
 
50 50
 	public function setAllianceID($ID) {
51
-		if($this->allianceID == $ID)
51
+		if ($this->allianceID == $ID)
52 52
 			return;
53
-		$this->allianceID=$ID;
53
+		$this->allianceID = $ID;
54 54
 	}
55 55
 
56 56
 	public function killPlayerByPlayer(AbstractSmrPlayer $killer) {
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		$db = MySqlDatabase::getInstance();
77 77
 		$db->query('REPLACE INTO cached_dummys ' .
78 78
 					'(type, id, info) ' .
79
-					'VALUES (\'DummyPlayer\', '.$db->escapeString($this->getPlayerName()).', '.$db->escapeString($cache).')');
79
+					'VALUES (\'DummyPlayer\', ' . $db->escapeString($this->getPlayerName()) . ', ' . $db->escapeString($cache) . ')');
80 80
 		 unserialize($cache);
81 81
 	}
82 82
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		$db->query('SELECT info FROM cached_dummys
86 86
 					WHERE type = \'DummyPlayer\'
87 87
 						AND id = ' . $db->escapeString($name) . ' LIMIT 1');
88
-		if($db->nextRecord()) {
88
+		if ($db->nextRecord()) {
89 89
 			$return = unserialize($db->getField('info'));
90 90
 			return $return;
91 91
 		}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		$db->query('SELECT id FROM cached_dummys
101 101
 					WHERE type = \'DummyPlayer\'');
102 102
 		$dummyNames = array();
103
-		while($db->nextRecord()) {
103
+		while ($db->nextRecord()) {
104 104
 			$dummyNames[] = $db->getField('id');
105 105
 		}
106 106
 		return $dummyNames;
Please login to merge, or discard this patch.
src/lib/Default/AbstractSmrPlayer.class.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
 			create_error('The saved sector must be in the box!');
1712 1712
 		}
1713 1713
 
1714
-		$storedDestinations =& $this->getStoredDestinations();
1714
+		$storedDestinations = & $this->getStoredDestinations();
1715 1715
 		foreach ($storedDestinations as &$sd) {
1716 1716
 			if ($sd['SectorID'] == $sectorID) {
1717 1717
 				$sd['OffsetTop'] = $offsetTop;
@@ -2034,13 +2034,13 @@  discard block
 block discarded – undo
2034 2034
 			$this->db->query('SELECT type,amount FROM player_hof WHERE ' . $this->SQL);
2035 2035
 			$this->HOF = array();
2036 2036
 			while ($this->db->nextRecord()) {
2037
-				$hof =& $this->HOF;
2037
+				$hof = & $this->HOF;
2038 2038
 				$typeList = explode(':', $this->db->getField('type'));
2039 2039
 				foreach ($typeList as $type) {
2040 2040
 					if (!isset($hof[$type])) {
2041 2041
 						$hof[$type] = array();
2042 2042
 					}
2043
-					$hof =& $hof[$type];
2043
+					$hof = & $hof[$type];
2044 2044
 				}
2045 2045
 				$hof = $this->db->getFloat('amount');
2046 2046
 			}
@@ -2119,8 +2119,8 @@  discard block
 block discarded – undo
2119 2119
 		}
2120 2120
 		self::$HOFVis[$hofType] = $visibility;
2121 2121
 
2122
-		$hof =& $this->HOF;
2123
-		$hofChanged =& $this->hasHOFChanged;
2122
+		$hof = & $this->HOF;
2123
+		$hofChanged = & $this->hasHOFChanged;
2124 2124
 		$new = false;
2125 2125
 		foreach ($typeList as $type) {
2126 2126
 			if (!isset($hofChanged[$type])) {
@@ -2130,8 +2130,8 @@  discard block
 block discarded – undo
2130 2130
 				$hof[$type] = array();
2131 2131
 				$new = true;
2132 2132
 			}
2133
-			$hof =& $hof[$type];
2134
-			$hofChanged =& $hofChanged[$type];
2133
+			$hof = & $hof[$type];
2134
+			$hofChanged = & $hofChanged[$type];
2135 2135
 		}
2136 2136
 		if ($hofChanged == null) {
2137 2137
 			$hofChanged = self::HOF_CHANGED;
@@ -2780,7 +2780,7 @@  discard block
 block discarded – undo
2780 2780
 			'Starting Sector' => $this->getSectorID()
2781 2781
 		);
2782 2782
 
2783
-		$this->missions[$missionID] =& $mission;
2783
+		$this->missions[$missionID] = & $mission;
2784 2784
 		$this->setupMissionStep($missionID);
2785 2785
 		$this->rebuildMission($missionID);
2786 2786
 
@@ -2830,7 +2830,7 @@  discard block
 block discarded – undo
2830 2830
 
2831 2831
 	public function claimMissionReward($missionID) {
2832 2832
 		$this->getMissions();
2833
-		$mission =& $this->missions[$missionID];
2833
+		$mission = & $this->missions[$missionID];
2834 2834
 		if ($mission === false) {
2835 2835
 			throw new Exception('Unknown mission: ' . $missionID);
2836 2836
 		}
Please login to merge, or discard this patch.
src/engine/Default/combat_simulator.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,79 +1,79 @@  discard block
 block discarded – undo
1 1
 <?php declare(strict_types=1);
2
-$template->assign('PageTopic','Combat Simulator');
2
+$template->assign('PageTopic', 'Combat Simulator');
3 3
 
4
-$template->assign('EditDummysLink',SmrSession::getNewHREF(create_container('skeleton.php','edit_dummys.php')));
4
+$template->assign('EditDummysLink', SmrSession::getNewHREF(create_container('skeleton.php', 'edit_dummys.php')));
5 5
 $template->assign('DummyNames', DummyPlayer::getDummyPlayerNames());
6 6
 
7 7
 $duplicates = false;
8 8
 $usedNames = array();
9 9
 $realAttackers = array();
10 10
 $attackers = array();
11
-$i=1;
12
-if(isset($_POST['attackers']))
13
-	foreach($_POST['attackers'] as $attackerName) {
14
-		if($attackerName=='none')
11
+$i = 1;
12
+if (isset($_POST['attackers']))
13
+	foreach ($_POST['attackers'] as $attackerName) {
14
+		if ($attackerName == 'none')
15 15
 			continue;
16
-		if(isset($usedNames[$attackerName])) {
16
+		if (isset($usedNames[$attackerName])) {
17 17
 			$duplicates = true;
18 18
 			continue;
19 19
 		}
20 20
 		$usedNames[$attackerName] = true;
21
-		$attackers[$i] =& DummyPlayer::getCachedDummyPlayer($attackerName);
21
+		$attackers[$i] = & DummyPlayer::getCachedDummyPlayer($attackerName);
22 22
 		$attackers[$i]->setAllianceID(1);
23
-		$realAttackers[$i] =& $attackers[$i];
23
+		$realAttackers[$i] = & $attackers[$i];
24 24
 		++$i;
25 25
 	}
26 26
 
27
-for(;$i<=10;++$i)
27
+for (;$i <= 10; ++$i)
28 28
 	$attackers[$i] = null;
29
-$template->assign('Attackers',$attackers);
29
+$template->assign('Attackers', $attackers);
30 30
 
31
-$i=1;
31
+$i = 1;
32 32
 $realDefenders = array();
33 33
 $defenders = array();
34
-if(isset($_POST['defenders']))
35
-	foreach($_POST['defenders'] as $defenderName) {
36
-		if($defenderName=='none')
34
+if (isset($_POST['defenders']))
35
+	foreach ($_POST['defenders'] as $defenderName) {
36
+		if ($defenderName == 'none')
37 37
 			continue;
38
-		if(isset($usedNames[$defenderName])) {
38
+		if (isset($usedNames[$defenderName])) {
39 39
 			$duplicates = true;
40 40
 			continue;
41 41
 		}
42 42
 		$usedNames[$attackerName] = true;
43
-		$defenders[$i] =& DummyPlayer::getCachedDummyPlayer($defenderName);
43
+		$defenders[$i] = & DummyPlayer::getCachedDummyPlayer($defenderName);
44 44
 		$defenders[$i]->setAllianceID(2);
45
-		$realDefenders[$i] =& $defenders[$i];
45
+		$realDefenders[$i] = & $defenders[$i];
46 46
 		++$i;
47 47
 	}
48 48
 
49
-for(;$i<=10;++$i)
49
+for (;$i <= 10; ++$i)
50 50
 	$defenders[$i] = null;
51
-$template->assign('Defenders',$defenders);
51
+$template->assign('Defenders', $defenders);
52 52
 
53
-$template->assign('Duplicates',$duplicates);
53
+$template->assign('Duplicates', $duplicates);
54 54
 
55
-$template->assign('CombatSimHREF',SmrSession::getNewHREF(create_container('skeleton.php','combat_simulator.php')));
55
+$template->assign('CombatSimHREF', SmrSession::getNewHREF(create_container('skeleton.php', 'combat_simulator.php')));
56 56
 
57 57
 if (!empty($realAttackers) && !empty($realDefenders)) {
58
-	if(isset($_REQUEST['run'])) {
59
-		runAnAttack($realAttackers,$realDefenders);
58
+	if (isset($_REQUEST['run'])) {
59
+		runAnAttack($realAttackers, $realDefenders);
60 60
 	}
61
-	if(isset($_REQUEST['death_run'])) {
62
-		while(count($realAttackers)>0 && count($realDefenders)>0) {
63
-			runAnAttack($realAttackers,$realDefenders);
64
-			foreach($realAttackers as $key => &$teamPlayer) {
65
-				if($teamPlayer->isDead())
61
+	if (isset($_REQUEST['death_run'])) {
62
+		while (count($realAttackers) > 0 && count($realDefenders) > 0) {
63
+			runAnAttack($realAttackers, $realDefenders);
64
+			foreach ($realAttackers as $key => &$teamPlayer) {
65
+				if ($teamPlayer->isDead())
66 66
 					unset($realAttackers[$key]);
67 67
 			} unset($teamPlayer);
68
-			foreach($realDefenders as $key => &$teamPlayer) {
69
-				if($teamPlayer->isDead())
68
+			foreach ($realDefenders as $key => &$teamPlayer) {
69
+				if ($teamPlayer->isDead())
70 70
 					unset($realDefenders[$key]);
71 71
 			} unset($teamPlayer);
72 72
 		}
73 73
 	}
74 74
 }
75 75
 
76
-function runAnAttack($realAttackers,$realDefenders) {
76
+function runAnAttack($realAttackers, $realDefenders) {
77 77
 	global $template;
78 78
 	$results = array('Attackers' => array('Traders' => array(), 'TotalDamage' => 0),
79 79
 					'Defenders' => array('Traders' => array(), 'TotalDamage' => 0));
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 	}
85 85
 	foreach ($realDefenders as $accountID => $teamPlayer) {
86 86
 		$playerResults = $teamPlayer->shootPlayers($realAttackers);
87
-		$results['Defenders']['Traders'][]  = $playerResults;
87
+		$results['Defenders']['Traders'][] = $playerResults;
88 88
 		$results['Defenders']['TotalDamage'] += $playerResults['TotalDamage'];
89 89
 	}
90
-	$template->assign('TraderCombatResults',$results);
90
+	$template->assign('TraderCombatResults', $results);
91 91
 }
Please login to merge, or discard this patch.
src/lib/Default/AbstractMenu.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 		$menuItems[] = array('Link'=>Globals::getPlanetListHREF($alliance_id), 'Text'=>'Defense');
42 42
 		$menuItems[] = array('Link'=>Globals::getPlanetListFinancialHREF($alliance_id), 'Text'=>'Financial');
43 43
 		// make the selected index bold
44
-		$boldItem =& $menuItems[$selected_index]['Text'];
44
+		$boldItem = & $menuItems[$selected_index]['Text'];
45 45
 		$boldItem = '<span class="bold">' . $boldItem . '</span>';
46 46
 		$template->assign('MenuItems', $menuItems);
47 47
 	}
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 			'Text' => 'Game News',
142 142
 		];
143 143
 		// make the selected index bold
144
-		$boldItem =& $menuItems[$selected_index]['Text'];
144
+		$boldItem = & $menuItems[$selected_index]['Text'];
145 145
 		$boldItem = '<b>' . $boldItem . '</b>';
146 146
 		$template->assign('MenuItems', $menuItems);
147 147
 	}
Please login to merge, or discard this patch.
test/SmrTest/lib/DefaultGame/SmrPlanetIntegrationTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -230,13 +230,13 @@
 block discarded – undo
230 230
 		$planet->increaseBuilding(PLANET_HANGAR, 4);
231 231
 		$this->assertTrue($planet->hasBuilding(PLANET_HANGAR));
232 232
 		$this->assertSame(4, $planet->getBuilding(PLANET_HANGAR));
233
-		$this->assertSame(4/3, $planet->getLevel());
233
+		$this->assertSame(4 / 3, $planet->getLevel());
234 234
 
235 235
 		// Destroy some hangars
236 236
 		$planet->destroyBuilding(PLANET_HANGAR, 2);
237 237
 		$this->assertTrue($planet->hasBuilding(PLANET_HANGAR));
238 238
 		$this->assertSame(2, $planet->getBuilding(PLANET_HANGAR));
239
-		$this->assertSame(2/3, $planet->getLevel());
239
+		$this->assertSame(2 / 3, $planet->getLevel());
240 240
 	}
241 241
 
242 242
 }
Please login to merge, or discard this patch.
test/SmrTest/lib/DefaultGame/AbstractSmrShipTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@
 block discarded – undo
100 100
 		$ship = new AbstractSmrShip($this->player);
101 101
 		$this->expectException(\Exception::class);
102 102
 		$this->expectExceptionMessage('Ship does not have the supported hardware!');
103
-		$ship->setIllusion(SHIP_TYPE_THIEF, 12, 13);;
103
+		$ship->setIllusion(SHIP_TYPE_THIEF, 12, 13); ;
104 104
 	}
105 105
 
106 106
 	public function test_hardware() {
Please login to merge, or discard this patch.