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

Passed
Pull Request — master (#998)
by Dan
05:35
created
src/tools/npc/npc.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		}
120 120
 
121 121
 		try {
122
-			$TRADE_ROUTE =& $GLOBALS['TRADE_ROUTE'];
122
+			$TRADE_ROUTE = & $GLOBALS['TRADE_ROUTE'];
123 123
 			debug('Action #' . $actions);
124 124
 
125 125
 			//We have to reload player on each loop
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
 			}
139 139
 
140 140
 			if (!isset($TRADE_ROUTE)) { //We only want to change trade route if there isn't already one set.
141
-				$TRADE_ROUTES =& findRoutes($player);
142
-				$TRADE_ROUTE =& changeRoute($TRADE_ROUTES);
141
+				$TRADE_ROUTES = & findRoutes($player);
142
+				$TRADE_ROUTE = & changeRoute($TRADE_ROUTES);
143 143
 			}
144 144
 
145 145
 			if ($player->isDead()) {
146 146
 				debug('Some evil person killed us, let\'s move on now.');
147 147
 				$previousContainer = null; //We died, we don't care what we were doing beforehand.
148
-				$TRADE_ROUTE =& changeRoute($TRADE_ROUTES); //Change route
148
+				$TRADE_ROUTE = & changeRoute($TRADE_ROUTES); //Change route
149 149
 				processContainer(create_container('death_processing.php'));
150 150
 			}
151 151
 			if ($player->getNewbieTurns() <= NEWBIE_TURNS_WARNING_LIMIT && $player->getNewbieWarning()) {
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 								processContainer(tradeGoods($goodID, $player, $port));
228 228
 							} else {
229 229
 								//Move to next route or fed.
230
-								if (($TRADE_ROUTE =& changeRoute($TRADE_ROUTES)) === false) {
230
+								if (($TRADE_ROUTE = & changeRoute($TRADE_ROUTES)) === false) {
231 231
 									debug('Changing Route Failed');
232 232
 									processContainer(plotToFed($player));
233 233
 								} else {
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 							processContainer(tradeGoods($goodID, $player, $port));
255 255
 						} else {
256 256
 							//Move to next route or fed.
257
-							if (($TRADE_ROUTE =& changeRoute($TRADE_ROUTES)) === false) {
257
+							if (($TRADE_ROUTE = & changeRoute($TRADE_ROUTES)) === false) {
258 258
 								debug('Changing Route Failed');
259 259
 								processContainer(plotToFed($player));
260 260
 							} else {
@@ -586,9 +586,9 @@  discard block
 block discarded – undo
586 586
 		return $false;
587 587
 	}
588 588
 	$routeKey = array_rand($tradeRoutes);
589
-	$tradeRoute =& $tradeRoutes[$routeKey];
589
+	$tradeRoute = & $tradeRoutes[$routeKey];
590 590
 	unset($tradeRoutes[$routeKey]);
591
-	$GLOBALS['TRADE_ROUTE'] =& $tradeRoute;
591
+	$GLOBALS['TRADE_ROUTE'] = & $tradeRoute;
592 592
 	debug('Switched route', $tradeRoute);
593 593
 	return $tradeRoute;
594 594
 }
Please login to merge, or discard this patch.
src/lib/Default/SmrWeapon.class.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 			// If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
198 198
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
199 199
 		}
200
-		$damage =& $this->getModifiedDamage();
200
+		$damage = & $this->getModifiedDamage();
201 201
 		return $damage;
202 202
 	}
203 203
 	
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 			// If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
207 207
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
208 208
 		}
209
-		$damage =& $this->getModifiedDamage();
209
+		$damage = & $this->getModifiedDamage();
210 210
 		return $damage;
211 211
 	}
212 212
 	
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 			// If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
216 216
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
217 217
 		}
218
-		$damage =& $this->getModifiedDamage();
218
+		$damage = & $this->getModifiedDamage();
219 219
 		
220 220
 		$planetMod = self::PLANET_DAMAGE_MOD;
221 221
 		$damage['MaxDamage'] = ICeil($damage['MaxDamage'] * $planetMod);
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 			$return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
236 236
 			return $return;
237 237
 		}
238
-		$damage =& $this->getModifiedDamage();
238
+		$damage = & $this->getModifiedDamage();
239 239
 		return $damage;
240 240
 	}
241 241
 	
Please login to merge, or discard this patch.
src/lib/Default/SmrCombatDrones.class.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 			// If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
133 133
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
134 134
 		}
135
-		$damage =& $this->getModifiedDamage();
135
+		$damage = & $this->getModifiedDamage();
136 136
 		$damage['Launched'] = ICeil($this->getNumberOfCDs() * $this->getModifiedAccuracyAgainstForces($weaponPlayer, $forces) / 100);
137 137
 		$damage['Kamikaze'] = 0;
138 138
 		if ($weaponPlayer->isCombatDronesKamikazeOnMines()) { // If kamikaze then damage is same as MINE_ARMOUR
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			// If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
157 157
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
158 158
 		}
159
-		$damage =& $this->getModifiedDamage();
159
+		$damage = & $this->getModifiedDamage();
160 160
 		$damage['Launched'] = ICeil($this->getNumberOfCDs() * $this->getModifiedAccuracyAgainstPort($weaponPlayer, $port) / 100);
161 161
 		$damage['MaxDamage'] = ICeil($damage['Launched'] * $damage['MaxDamage']);
162 162
 		$damage['Shield'] = ICeil($damage['Launched'] * $damage['Shield']);
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 			// If we can't shoot forces then just return a damageless array and don't waste resources calculated any damage mods.
171 171
 			return array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
172 172
 		}
173
-		$damage =& $this->getModifiedDamage();
173
+		$damage = & $this->getModifiedDamage();
174 174
 		$damage['Launched'] = ICeil($this->getNumberOfCDs() * $this->getModifiedAccuracyAgainstPlanet($weaponPlayer, $planet) / 100);
175 175
 		$planetMod = self::PLANET_DAMAGE_MOD;
176 176
 		$damage['MaxDamage'] = ICeil($damage['Launched'] * $damage['MaxDamage'] * $planetMod);
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 			$return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
186 186
 			return $return;
187 187
 		}
188
-		$damage =& $this->getModifiedDamage();
188
+		$damage = & $this->getModifiedDamage();
189 189
 		if ($targetPlayer->getShip()->hasDCS()) {
190 190
 			$damage['MaxDamage'] *= DCS_PLAYER_DAMAGE_DECIMAL_PERCENT;
191 191
 			$damage['Shield'] *= DCS_PLAYER_DAMAGE_DECIMAL_PERCENT;
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 			$return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
204 204
 			return $return;
205 205
 		}
206
-		$damage =& $this->getModifiedDamage();
206
+		$damage = & $this->getModifiedDamage();
207 207
 		
208 208
 		if ($targetPlayer->getShip()->hasDCS()) {
209 209
 			$damage['MaxDamage'] *= DCS_FORCE_DAMAGE_DECIMAL_PERCENT;
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 			$return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
224 224
 			return $return;
225 225
 		}
226
-		$damage =& $this->getModifiedDamage();
226
+		$damage = & $this->getModifiedDamage();
227 227
 		
228 228
 		if ($targetPlayer->getShip()->hasDCS()) {
229 229
 			$damage['MaxDamage'] *= DCS_PORT_DAMAGE_DECIMAL_PERCENT;
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 			$return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
243 243
 			return $return;
244 244
 		}
245
-		$damage =& $this->getModifiedDamage();
245
+		$damage = & $this->getModifiedDamage();
246 246
 		
247 247
 		if ($targetPlayer->getShip()->hasDCS()) {
248 248
 			$damage['MaxDamage'] *= DCS_PLANET_DAMAGE_DECIMAL_PERCENT;
Please login to merge, or discard this patch.
src/lib/Default/SmrScoutDrones.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
 			$return = array('MaxDamage' => 0, 'Shield' => 0, 'Armour' => 0, 'Rollover' => $this->isDamageRollover());
81 81
 			return $return;
82 82
 		}
83
-		$damage =& $this->getModifiedDamage();
83
+		$damage = & $this->getModifiedDamage();
84 84
 		$damage['Launched'] = ICeil($this->getNumberOfSDs() * $this->getModifiedForceAccuracyAgainstPlayer($forces, $targetPlayer) / 100);
85 85
 		$damage['MaxDamage'] = ICeil($damage['Launched'] * $damage['MaxDamage']);
86 86
 		$damage['Shield'] = ICeil($damage['Launched'] * $damage['Shield']);
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
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 		$menuItems[] = array('Link'=>Globals::getPlanetListHREF($alliance_id), 'Text'=>'Defense');
13 13
 		$menuItems[] = array('Link'=>Globals::getPlanetListFinancialHREF($alliance_id), 'Text'=>'Financial');
14 14
 		// make the selected index bold
15
-		$boldItem =& $menuItems[$selected_index]['Text'];
15
+		$boldItem = & $menuItems[$selected_index]['Text'];
16 16
 		$boldItem = '<span class="bold">' . $boldItem . '</span>';
17 17
 		$template->assign('MenuItems', $menuItems);
18 18
 	}
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		$menuItems[] = ['Link' => SmrSession::getNewHREF($container),
108 108
 		                'Text' => 'Game News'];
109 109
 		// make the selected index bold
110
-		$boldItem =& $menuItems[$selected_index]['Text'];
110
+		$boldItem = & $menuItems[$selected_index]['Text'];
111 111
 		$boldItem = '<b>' . $boldItem . '</b>';
112 112
 		$template->assign('MenuItems', $menuItems);
113 113
 	}
Please login to merge, or discard this patch.
src/lib/Default/MySqlDatabase.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 	}
39 39
 
40 40
 	public static function mysqliFactory(MySqlProperties $mysqlProperties): mysqli {
41
-		if (!mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT)) {
41
+		if (!mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT)) {
42 42
 			throw new RuntimeException('Failed to enable mysqli error reporting');
43 43
 		}
44 44
 		$mysql = new mysqli(
Please login to merge, or discard this patch.
src/lib/Default/DummyShip.class.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 		$this->cargo_left = $this->getCargoHolds();
18 18
 	}
19 19
 	protected function doFullUNO() {
20
-		foreach($this->getMaxHardware() as $hardwareTypeID => $max) {
20
+		foreach ($this->getMaxHardware() as $hardwareTypeID => $max) {
21 21
 			$this->hardware[$hardwareTypeID] = $max;
22 22
 			$this->oldHardware[$hardwareTypeID] = $max;
23 23
 		}
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 	}
48 48
 
49 49
 	public function getIllusionShip() {
50
-		if(!isset($this->illusionShip)) {
51
-			$this->illusionShip=false;
50
+		if (!isset($this->illusionShip)) {
51
+			$this->illusionShip = false;
52 52
 		}
53 53
 		return $this->illusionShip;
54 54
 	}
@@ -58,20 +58,20 @@  discard block
 block discarded – undo
58 58
 		$db = MySqlDatabase::getInstance();
59 59
 		$db->query('REPLACE INTO cached_dummys ' .
60 60
 					'(type, id, info) ' .
61
-					'VALUES (\'DummyShip\', '.$db->escapeString($this->getPlayer()->getPlayerName()).', '.$db->escapeString($cache).')');
61
+					'VALUES (\'DummyShip\', ' . $db->escapeString($this->getPlayer()->getPlayerName()) . ', ' . $db->escapeString($cache) . ')');
62 62
 		unserialize($cache);
63 63
 	}
64 64
 
65 65
 	public static function getCachedDummyShip(AbstractSmrPlayer $player) {
66
-		if(!isset(self::$CACHED_DUMMY_SHIPS[$player->getPlayerName()])) {
66
+		if (!isset(self::$CACHED_DUMMY_SHIPS[$player->getPlayerName()])) {
67 67
 			$db = MySqlDatabase::getInstance();
68 68
 			$db->query('SELECT info FROM cached_dummys
69 69
 						WHERE type = \'DummyShip\'
70 70
 						AND id = ' . $db->escapeString($player->getPlayerName()) . ' LIMIT 1');
71
-			if($db->nextRecord()) {
71
+			if ($db->nextRecord()) {
72 72
 				$return = unserialize($db->getField('info'));
73 73
 				$return->regenerate($player);
74
-				self::$CACHED_DUMMY_SHIPS[$player->getPlayerName()] =& $return;
74
+				self::$CACHED_DUMMY_SHIPS[$player->getPlayerName()] = & $return;
75 75
 			} else {
76 76
 				self::$CACHED_DUMMY_SHIPS[$player->getPlayerName()] = new DummyShip($player);
77 77
 			}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		$db->query('SELECT id FROM cached_dummys
85 85
 					WHERE type = \'DummyShip\'');
86 86
 		$dummyNames = array();
87
-		while($db->nextRecord()) {
87
+		while ($db->nextRecord()) {
88 88
 			$dummyNames[] = $db->getField('id');
89 89
 		}
90 90
 		return $dummyNames;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
 
95 95
 	public function __sleep() {
96
-		return array('gameID','weapons');
96
+		return array('gameID', 'weapons');
97 97
 	}
98 98
 
99 99
 	public function __wakeup() {
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/tools/discord/GameLink.class.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,10 +3,10 @@
 block discarded – undo
3 3
 // Holds information linking the received message and the game data
4 4
 class GameLink
5 5
 {
6
-	public $valid = false;  // identifies if the message is linked to game data
7
-	public $account;        // SmrAccount instance
8
-	public $alliance;       // SmrAlliance instance
9
-	public $player;         // SmrPlayer instance
6
+	public $valid = false; // identifies if the message is linked to game data
7
+	public $account; // SmrAccount instance
8
+	public $alliance; // SmrAlliance instance
9
+	public $player; // SmrPlayer instance
10 10
 
11 11
 	// $author can be either Discord\Parts\User\{User,Member}
12 12
 	function __construct(Discord\Parts\Channel\Channel $channel, $author) {
Please login to merge, or discard this patch.