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 (#1035)
by Dan
05:02
created
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/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.
src/tools/npc/npc.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		}
117 117
 
118 118
 		try {
119
-			$TRADE_ROUTE =& $GLOBALS['TRADE_ROUTE'];
119
+			$TRADE_ROUTE = & $GLOBALS['TRADE_ROUTE'];
120 120
 			debug('Action #' . $actions);
121 121
 
122 122
 			//We have to reload player on each loop
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
 			}
141 141
 
142 142
 			if (!isset($TRADE_ROUTE)) { //We only want to change trade route if there isn't already one set.
143
-				$TRADE_ROUTES =& findRoutes($player);
144
-				$TRADE_ROUTE =& changeRoute($TRADE_ROUTES);
143
+				$TRADE_ROUTES = & findRoutes($player);
144
+				$TRADE_ROUTE = & changeRoute($TRADE_ROUTES);
145 145
 			}
146 146
 
147 147
 			if ($player->isDead()) {
148 148
 				debug('Some evil person killed us, let\'s move on now.');
149 149
 				$previousContainer = null; //We died, we don't care what we were doing beforehand.
150
-				$TRADE_ROUTE =& changeRoute($TRADE_ROUTES); //Change route
150
+				$TRADE_ROUTE = & changeRoute($TRADE_ROUTES); //Change route
151 151
 				processContainer(Page::create('death_processing.php'));
152 152
 			}
153 153
 			if ($player->getNewbieTurns() <= NEWBIE_TURNS_WARNING_LIMIT && $player->getNewbieWarning()) {
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 								processContainer(tradeGoods($goodID, $player, $port));
224 224
 							} else {
225 225
 								//Move to next route or fed.
226
-								if (($TRADE_ROUTE =& changeRoute($TRADE_ROUTES)) === false) {
226
+								if (($TRADE_ROUTE = & changeRoute($TRADE_ROUTES)) === false) {
227 227
 									debug('Changing Route Failed');
228 228
 									processContainer(plotToFed($player));
229 229
 								} else {
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 							processContainer(tradeGoods($goodID, $player, $port));
251 251
 						} else {
252 252
 							//Move to next route or fed.
253
-							if (($TRADE_ROUTE =& changeRoute($TRADE_ROUTES)) === false) {
253
+							if (($TRADE_ROUTE = & changeRoute($TRADE_ROUTES)) === false) {
254 254
 								debug('Changing Route Failed');
255 255
 								processContainer(plotToFed($player));
256 256
 							} else {
@@ -582,9 +582,9 @@  discard block
 block discarded – undo
582 582
 		return $false;
583 583
 	}
584 584
 	$routeKey = array_rand($tradeRoutes);
585
-	$tradeRoute =& $tradeRoutes[$routeKey];
585
+	$tradeRoute = & $tradeRoutes[$routeKey];
586 586
 	unset($tradeRoutes[$routeKey]);
587
-	$GLOBALS['TRADE_ROUTE'] =& $tradeRoute;
587
+	$GLOBALS['TRADE_ROUTE'] = & $tradeRoute;
588 588
 	debug('Switched route', $tradeRoute);
589 589
 	return $tradeRoute;
590 590
 }
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', Page::create('skeleton.php','edit_dummys.php')->href());
4
+$template->assign('EditDummysLink', Page::create('skeleton.php', 'edit_dummys.php')->href());
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', Page::create('skeleton.php','combat_simulator.php')->href());
55
+$template->assign('CombatSimHREF', Page::create('skeleton.php', 'combat_simulator.php')->href());
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/SmrSession.class.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	public static int $last_accessed;
35 35
 	private static Time $pageRequestTime;
36 36
 
37
-	protected static ?array $previousAjaxReturns;
37
+	protected static ? array $previousAjaxReturns;
38 38
 	protected static array $ajaxReturns = array();
39 39
 
40 40
 	/**
@@ -136,8 +136,7 @@  discard block
 block discarded – undo
136 136
 				} elseif ($value['RemainingPageLoads'] < 0) {
137 137
 					//This link is no longer valid
138 138
 					unset(self::$var[$key]);
139
-				} else {
140
-					--self::$var[$key]['RemainingPageLoads'];
139
+				} else {--self::$var[$key]['RemainingPageLoads'];
141 140
 					if (isset($value['CommonID'])) {
142 141
 						self::$commonIDs[$value['CommonID']] = $key;
143 142
 					}
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) {
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		$db = MySqlDatabase::getInstance();
76 76
 		$db->query('REPLACE INTO cached_dummys ' .
77 77
 					'(type, id, info) ' .
78
-					'VALUES (\'DummyPlayer\', '.$db->escapeString($this->getPlayerName()).', '.$db->escapeObject($this).')');
78
+					'VALUES (\'DummyPlayer\', ' . $db->escapeString($this->getPlayerName()) . ', ' . $db->escapeObject($this) . ')');
79 79
 	}
80 80
 
81 81
 	public static function &getCachedDummyPlayer($name) {
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		$db->query('SELECT info FROM cached_dummys
84 84
 					WHERE type = \'DummyPlayer\'
85 85
 						AND id = ' . $db->escapeString($name) . ' LIMIT 1');
86
-		if($db->nextRecord()) {
86
+		if ($db->nextRecord()) {
87 87
 			$return = $db->getObject('info');
88 88
 			return $return;
89 89
 		}
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 		$db->query('SELECT id FROM cached_dummys
99 99
 					WHERE type = \'DummyPlayer\'');
100 100
 		$dummyNames = array();
101
-		while($db->nextRecord()) {
101
+		while ($db->nextRecord()) {
102 102
 			$dummyNames[] = $db->getField('id');
103 103
 		}
104 104
 		return $dummyNames;
Please login to merge, or discard this patch.