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 (#812)
by Dan
04:13
created
lib/Default/AbstractSmrPort.class.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -960,7 +960,7 @@
 block discarded – undo
960 960
 	
961 961
 	public function calculateExperiencePercent($idealPrice, $offerPrice, $bargainPrice, $transactionType) {
962 962
 		if (($transactionType == 'Sell' && $bargainPrice < $offerPrice) ||
963
-		    ($transactionType == 'Buy' && $bargainPrice > $offerPrice)) {
963
+			($transactionType == 'Buy' && $bargainPrice > $offerPrice)) {
964 964
 			return 0;
965 965
 		}
966 966
 		if ($bargainPrice == $idealPrice || $transactionType == 'Steal') {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
 			do {
1181 1181
 				$targetPlayer = $targetPlayers[array_rand($targetPlayers)];
1182 1182
 			} while ($results['TotalShotsPerTargetPlayer'][$targetPlayer->getAccountID()] > min($results['TotalShotsPerTargetPlayer']));
1183
-			$results['Weapons'][$orderID] =& $weapon->shootPlayerAsPort($this, $targetPlayer);
1183
+			$results['Weapons'][$orderID] = & $weapon->shootPlayerAsPort($this, $targetPlayer);
1184 1184
 			$results['TotalShotsPerTargetPlayer'][$targetPlayer->getAccountID()]++;
1185 1185
 			if ($results['Weapons'][$orderID]['Hit']) {
1186 1186
 				$results['TotalDamage'] += $results['Weapons'][$orderID]['ActualDamage']['TotalDamage'];
@@ -1189,7 +1189,7 @@  discard block
 block discarded – undo
1189 1189
 		}
1190 1190
 		if ($this->hasCDs()) {
1191 1191
 			$thisCDs = new SmrCombatDrones($this->getGameID(), $this->getCDs(), true);
1192
-			$results['Drones'] =& $thisCDs->shootPlayerAsPort($this, $targetPlayers[array_rand($targetPlayers)]);
1192
+			$results['Drones'] = & $thisCDs->shootPlayerAsPort($this, $targetPlayers[array_rand($targetPlayers)]);
1193 1193
 			$results['TotalDamage'] += $results['Drones']['ActualDamage']['TotalDamage'];
1194 1194
 			$results['TotalDamagePerTargetPlayer'][$results['Drones']['TargetPlayer']->getAccountID()] += $results['Drones']['ActualDamage']['TotalDamage'];
1195 1195
 		}
Please login to merge, or discard this patch.
lib/Default/MySqlDatabase.class.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 	public function __construct($dbName) {
14 14
 		if (!self::$dbConn) {
15 15
 			self::$dbConn = new mysqli(self::$host, self::$user, self::$password,
16
-			                           $dbName, self::$port, self::$socket);
16
+									   $dbName, self::$port, self::$socket);
17 17
 			if (self::$dbConn->connect_errno) {
18 18
 				$this->error('Connection failed: ' . self::$dbConn->connect_error);
19 19
 			}
Please login to merge, or discard this patch.
lib/Default/ChessGame.class.php 2 patches
Braces   +13 added lines, -26 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@  discard block
 block discarded – undo
81 81
 			$this->blackID = $this->db->getInt('black_id');
82 82
 			$this->winner = $this->db->getInt('winner_id');
83 83
 			$this->resetHasMoved();
84
-		}
85
-		else {
84
+		} else {
86 85
 			throw new Exception('Chess game not found: ' . $chessGameID);
87 86
 		}
88 87
 	}
@@ -149,8 +148,7 @@  discard block
 block discarded – undo
149 148
 					break;
150 149
 				}
151 150
 			}
152
-		}
153
-		catch(Exception $e) {
151
+		} catch(Exception $e) {
154 152
 			if($debugInfo === true) {
155 153
 				echo $e->getMessage() . EOL . $e->getTraceAsString() . EOL;
156 154
 			}
@@ -189,11 +187,9 @@  discard block
 block discarded – undo
189 187
 			if(!$mate && $this->hasEnded()) {
190 188
 				if($this->getWinner() != 0) {
191 189
 					$this->moves[] = ($this->getWinner() == $this->getWhiteID() ? 'Black' : 'White') . ' Resigned.';
192
-				}
193
-				else if(count($this->moves) < 2) {
190
+				} else if(count($this->moves) < 2) {
194 191
 					$this->moves[] = 'Game Cancelled.';
195
-				}
196
-				else {
192
+				} else {
197 193
 					$this->moves[] = 'Game Drawn.';
198 194
 				}
199 195
 			}
@@ -212,8 +208,7 @@  discard block
 block discarded – undo
212 208
 			for($x=0; $x < 8; $x++) {
213 209
 				if($board[$y][$x] == null) {
214 210
 					$blanks++;
215
-				}
216
-				else {
211
+				} else {
217 212
 					if($blanks > 0) {
218 213
 						$fen .= $blanks;
219 214
 						$blanks = 0;
@@ -268,8 +263,7 @@  discard block
 block discarded – undo
268 263
 					$fen .= '3';
269 264
 				break;
270 265
 			}
271
-		}
272
-		else {
266
+		} else {
273 267
 			$fen .= '-';
274 268
 		}
275 269
 		$fen .= ' 0 ' . floor(count($this->moves)/2);
@@ -386,8 +380,7 @@  discard block
 block discarded – undo
386 380
 		}
387 381
 		if($pieceID == ChessPiece::PAWN && ($startY == 1 || $startY == 6) && ($endY == 3 || $endY == 4)) {
388 382
 			$this->hasMoved[ChessPiece::PAWN] = array($endX, $endY);
389
-		}
390
-		else {
383
+		} else {
391 384
 			$this->hasMoved[ChessPiece::PAWN] = array(-1,-1);
392 385
 		}
393 386
 		return ($castling == 'Queen' ? '0-0-0' : ($castling == 'King' ? '0-0' : ''))
@@ -493,8 +486,7 @@  discard block
 block discarded – undo
493 486
 				$board[$toY][$castling['ToX']]->setX($castling['ToX']);
494 487
 				$board[$y][$castling['X']] = null;
495 488
 			}
496
-		}
497
-		else if($p->pieceID == ChessPiece::PAWN) {
489
+		} else if($p->pieceID == ChessPiece::PAWN) {
498 490
 			if($toY == 0 || $toY == 7) {
499 491
 				$pawnPromotion = $p->promote($pawnPromotionPiece, $board);
500 492
 			}
@@ -512,8 +504,7 @@  discard block
 block discarded – undo
512 504
 				}
513 505
 				$board[$hasMoved[ChessPiece::PAWN][1]][$hasMoved[ChessPiece::PAWN][0]] = null;
514 506
 			}
515
-		}
516
-		else if($p->pieceID == ChessPiece::ROOK && ($x == 0 || $x == 7) && $y == ($p->colour == self::PLAYER_WHITE ? 7 : 0)) {
507
+		} else if($p->pieceID == ChessPiece::ROOK && ($x == 0 || $x == 7) && $y == ($p->colour == self::PLAYER_WHITE ? 7 : 0)) {
517 508
 			//Rook moved?
518 509
 			if($hasMoved[$p->colour][ChessPiece::ROOK][$x==0?'Queen':'King'] === false) {
519 510
 				// We set rook moved in here as it's used for move info.
@@ -573,12 +564,10 @@  discard block
 block discarded – undo
573 564
 				$board[$y][$castling['X']]->setX($castling['X']);
574 565
 				$board[$toY][$castling['ToX']] = null;
575 566
 			}
576
-		}
577
-		else if($moveInfo['EnPassant'] === true) {
567
+		} else if($moveInfo['EnPassant'] === true) {
578 568
 			$board[$toY][$toX] = null;
579 569
 			$board[$hasMoved[ChessPiece::PAWN][1]][$hasMoved[ChessPiece::PAWN][0]] = $moveInfo['PieceTaken'];
580
-		}
581
-		else if($moveInfo['RookMoved'] !== false) {
570
+		} else if($moveInfo['RookMoved'] !== false) {
582 571
 			$hasMoved[$p->colour][ChessPiece::ROOK][$moveInfo['RookMoved']] = false;
583 572
 		}
584 573
 		if($moveInfo['RookTaken'] !== false) {
@@ -702,8 +691,7 @@  discard block
 block discarded – undo
702 691
 					$this->setWinner($forAccountID);
703 692
 					$return = 1;
704 693
 					SmrPlayer::sendMessageFromCasino($lastTurnPlayer->getGameID(), $this->getCurrentTurnAccountID(), 'You have just lost [chess=' . $this->getChessGameID() . '] against [player=' . $lastTurnPlayer->getPlayerID() . '].');
705
-				}
706
-				else {
694
+				} else {
707 695
 					SmrPlayer::sendMessageFromCasino($lastTurnPlayer->getGameID(), $this->getCurrentTurnAccountID(), 'It is now your turn in [chess=' . $this->getChessGameID() . '] against [player=' . $lastTurnPlayer->getPlayerID() . '].');
708 696
 					if($checking == 'CHECK') {
709 697
 						$currentPlayer->increaseHOF(1, array($chessType,'Moves','Check Given'), HOF_PUBLIC);
@@ -853,8 +841,7 @@  discard block
 block discarded – undo
853 841
 							SET end_time=' . $this->db->escapeNumber(TIME) . '
854 842
 							WHERE chess_game_id=' . $this->db->escapeNumber($this->chessGameID) . ';');
855 843
 			return 1;
856
-		}
857
-		else {
844
+		} else {
858 845
 			$loserColour = $this->getColourForAccountID($accountID);
859 846
 			$winnerAccountID = $this->getColourID(self::getOtherColour($loserColour));
860 847
 			$results = $this->setWinner($winnerAccountID);
Please login to merge, or discard this patch.
Spacing   +148 added lines, -149 removed lines patch added patch discarded remove patch
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
 					JOIN chess_game ON account_id = black_id OR account_id = white_id
34 34
 					WHERE end_time > ' . TIME . ' OR end_time IS NULL;');
35 35
 		$games = array();
36
-		while($db->nextRecord()) {
36
+		while ($db->nextRecord()) {
37 37
 			$game = self::getChessGame($db->getInt('chess_game_id'), $forceUpdate);
38
-			if($game->getCurrentTurnAccount()->isNPC()) {
38
+			if ($game->getCurrentTurnAccount()->isNPC()) {
39 39
 				$games[] = $game;
40 40
 			}
41 41
 		}
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		$db = new SmrMySqlDatabase();
47 47
 		$db->query('SELECT chess_game_id FROM chess_game WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND (black_id = ' . $db->escapeNumber($player->getAccountID()) . ' OR white_id = ' . $db->escapeNumber($player->getAccountID()) . ') AND (end_time > ' . TIME . ' OR end_time IS NULL);');
48 48
 		$games = array();
49
-		while($db->nextRecord()) {
49
+		while ($db->nextRecord()) {
50 50
 			$games[] = self::getChessGame($db->getInt('chess_game_id'));
51 51
 		}
52 52
 		return $games;
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
 		$db = new SmrMySqlDatabase();
57 57
 		$db->query('SELECT chess_game_id FROM chess_game WHERE black_id = ' . $db->escapeNumber($accountID) . ' OR white_id = ' . $db->escapeNumber($accountID) . ';');
58 58
 		$games = array();
59
-		while($db->nextRecord()) {
59
+		while ($db->nextRecord()) {
60 60
 			$games[] = self::getChessGame($db->getInt('chess_game_id'));
61 61
 		}
62 62
 		return $games;
63 63
 	}
64 64
 
65
-	public static function getChessGame($chessGameID,$forceUpdate = false) {
66
-		if($forceUpdate || !isset(self::$CACHE_CHESS_GAMES[$chessGameID])) {
65
+	public static function getChessGame($chessGameID, $forceUpdate = false) {
66
+		if ($forceUpdate || !isset(self::$CACHE_CHESS_GAMES[$chessGameID])) {
67 67
 			self::$CACHE_CHESS_GAMES[$chessGameID] = new ChessGame($chessGameID);
68 68
 		}
69 69
 		return self::$CACHE_CHESS_GAMES[$chessGameID];
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		$this->db->query('SELECT *
75 75
 						FROM chess_game
76 76
 						WHERE chess_game_id=' . $this->db->escapeNumber($chessGameID) . ' LIMIT 1;');
77
-		if($this->db->nextRecord()) {
77
+		if ($this->db->nextRecord()) {
78 78
 			$this->chessGameID = $chessGameID;
79 79
 			$this->gameID = $this->db->getInt('game_id');
80 80
 			$this->startDate = $this->db->getInt('start_time');
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
 	}
95 95
 
96 96
 	public static function isPlayerChecked(array &$board, array &$hasMoved, $colour) {
97
-		foreach($board as &$row) {
98
-			foreach($row as &$p) {
99
-				if($p != null && $p->colour != $colour && $p->isAttacking($board, $hasMoved, true)) {
97
+		foreach ($board as &$row) {
98
+			foreach ($row as &$p) {
99
+				if ($p != null && $p->colour != $colour && $p->isAttacking($board, $hasMoved, true)) {
100 100
 					return true;
101 101
 				}
102 102
 			}
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 					'King' => false
121 121
 				)
122 122
 			),
123
-			ChessPiece::PAWN => array(-1,-1)
123
+			ChessPiece::PAWN => array(-1, -1)
124 124
 		);
125 125
 	}
126 126
 
@@ -143,17 +143,17 @@  discard block
 block discarded – undo
143 143
 		$this->resetHasMoved();
144 144
 
145 145
 		try {
146
-			while($db->nextRecord()) {
147
-				if($debugInfo === true) {
146
+			while ($db->nextRecord()) {
147
+				if ($debugInfo === true) {
148 148
 					echo 'x=', $db->getInt('start_x'), ', y=', $db->getInt('start_y'), ', endX=', $db->getInt('end_x'), ', endY=', $db->getInt('end_y'), ', forAccountID=', $db->getInt('move_id') % 2 == 1 ? $this->getWhiteID() : $this->getBlackID(), EOL;
149 149
 				}
150
-				if(0 != $this->tryMove($db->getInt('start_x'), $db->getInt('start_y'), $db->getInt('end_x'), $db->getInt('end_y'), $db->getInt('move_id') % 2 == 1 ? $this->getWhiteID() : $this->getBlackID())) {
150
+				if (0 != $this->tryMove($db->getInt('start_x'), $db->getInt('start_y'), $db->getInt('end_x'), $db->getInt('end_y'), $db->getInt('move_id') % 2 == 1 ? $this->getWhiteID() : $this->getBlackID())) {
151 151
 					break;
152 152
 				}
153 153
 			}
154 154
 		}
155
-		catch(Exception $e) {
156
-			if($debugInfo === true) {
155
+		catch (Exception $e) {
156
+			if ($debugInfo === true) {
157 157
 				echo $e->getMessage() . EOL . $e->getTraceAsString() . EOL;
158 158
 			}
159 159
 			// We probably tried an invalid move - move on.
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 	}
162 162
 
163 163
 	public function getBoard() {
164
-		if($this->board == null) {
164
+		if ($this->board == null) {
165 165
 			$this->db->query('SELECT * FROM chess_game_pieces WHERE chess_game_id=' . $this->db->escapeNumber($this->chessGameID) . ';');
166 166
 			$pieces = array();
167
-			while($this->db->nextRecord()) {
167
+			while ($this->db->nextRecord()) {
168 168
 				$accountID = $this->db->getInt('account_id');
169 169
 				$pieces[] = new ChessPiece($this->chessGameID, $accountID, $this->getColourForAccountID($accountID), $this->db->getInt('piece_id'), $this->db->getInt('x'), $this->db->getInt('y'), $this->db->getInt('piece_no'));
170 170
 			}
@@ -179,20 +179,20 @@  discard block
 block discarded – undo
179 179
 	}
180 180
 
181 181
 	public function getMoves() {
182
-		if($this->moves == null) {
182
+		if ($this->moves == null) {
183 183
 			$this->db->query('SELECT * FROM chess_game_moves WHERE chess_game_id = ' . $this->db->escapeNumber($this->chessGameID) . ' ORDER BY move_id;');
184 184
 			$this->moves = array();
185 185
 			$mate = false;
186
-			while($this->db->nextRecord()) {
186
+			while ($this->db->nextRecord()) {
187 187
 				$pieceTakenID = $this->db->getField('piece_taken') == null ? null : $this->db->getInt('piece_taken');
188 188
 				$this->moves[] = $this->createMove($this->db->getInt('piece_id'), $this->db->getInt('start_x'), $this->db->getInt('start_y'), $this->db->getInt('end_x'), $this->db->getInt('end_y'), $pieceTakenID, $this->db->getField('checked'), $this->db->getInt('move_id') % 2 == 1 ? self::PLAYER_WHITE : self::PLAYER_BLACK, $this->db->getField('castling'), $this->db->getBoolean('en_passant'), $this->db->getInt('promote_piece_id'));
189 189
 				$mate = $this->db->getField('checked') == 'MATE';
190 190
 			}
191
-			if(!$mate && $this->hasEnded()) {
192
-				if($this->getWinner() != 0) {
191
+			if (!$mate && $this->hasEnded()) {
192
+				if ($this->getWinner() != 0) {
193 193
 					$this->moves[] = ($this->getWinner() == $this->getWhiteID() ? 'Black' : 'White') . ' Resigned.';
194 194
 				}
195
-				else if(count($this->moves) < 2) {
195
+				else if (count($this->moves) < 2) {
196 196
 					$this->moves[] = 'Game Cancelled.';
197 197
 				}
198 198
 				else {
@@ -205,30 +205,30 @@  discard block
 block discarded – undo
205 205
 
206 206
 	public function getFENString() {
207 207
 		$fen = '';
208
-		$board =& $this->getBoard();
208
+		$board = & $this->getBoard();
209 209
 		$blanks = 0;
210
-		for($y=0; $y < 8; $y++) {
211
-			if($y > 0) {
210
+		for ($y = 0; $y < 8; $y++) {
211
+			if ($y > 0) {
212 212
 				$fen .= '/';
213 213
 			}
214
-			for($x=0; $x < 8; $x++) {
215
-				if($board[$y][$x] == null) {
214
+			for ($x = 0; $x < 8; $x++) {
215
+				if ($board[$y][$x] == null) {
216 216
 					$blanks++;
217 217
 				}
218 218
 				else {
219
-					if($blanks > 0) {
219
+					if ($blanks > 0) {
220 220
 						$fen .= $blanks;
221 221
 						$blanks = 0;
222 222
 					}
223 223
 					$fen .= $board[$y][$x]->getPieceLetter();
224 224
 				}
225 225
 			}
226
-			if($blanks > 0) {
226
+			if ($blanks > 0) {
227 227
 				$fen .= $blanks;
228 228
 				$blanks = 0;
229 229
 			}
230 230
 		}
231
-		switch($this->getCurrentTurnColour()) {
231
+		switch ($this->getCurrentTurnColour()) {
232 232
 			case self::PLAYER_WHITE:
233 233
 				$fen .= ' w ';
234 234
 			break;
@@ -239,30 +239,30 @@  discard block
 block discarded – undo
239 239
 
240 240
 		// Castling
241 241
 		$castling = '';
242
-		if($this->hasMoved[self::PLAYER_WHITE][ChessPiece::KING] !== true) {
243
-			if($this->hasMoved[self::PLAYER_WHITE][ChessPiece::ROOK]['King'] !== true) {
242
+		if ($this->hasMoved[self::PLAYER_WHITE][ChessPiece::KING] !== true) {
243
+			if ($this->hasMoved[self::PLAYER_WHITE][ChessPiece::ROOK]['King'] !== true) {
244 244
 				$castling .= 'K';
245 245
 			}
246
-			if($this->hasMoved[self::PLAYER_WHITE][ChessPiece::ROOK]['Queen'] !== true) {
246
+			if ($this->hasMoved[self::PLAYER_WHITE][ChessPiece::ROOK]['Queen'] !== true) {
247 247
 				$castling .= 'Q';
248 248
 			}
249 249
 		}
250
-		if($this->hasMoved[self::PLAYER_BLACK][ChessPiece::KING] !== true) {
251
-			if($this->hasMoved[self::PLAYER_BLACK][ChessPiece::ROOK]['King'] !== true) {
250
+		if ($this->hasMoved[self::PLAYER_BLACK][ChessPiece::KING] !== true) {
251
+			if ($this->hasMoved[self::PLAYER_BLACK][ChessPiece::ROOK]['King'] !== true) {
252 252
 				$castling .= 'k';
253 253
 			}
254
-			if($this->hasMoved[self::PLAYER_BLACK][ChessPiece::ROOK]['Queen'] !== true) {
254
+			if ($this->hasMoved[self::PLAYER_BLACK][ChessPiece::ROOK]['Queen'] !== true) {
255 255
 				$castling .= 'q';
256 256
 			}
257 257
 		}
258
-		if($castling == '') {
258
+		if ($castling == '') {
259 259
 			$castling = '-';
260 260
 		}
261 261
 		$fen .= $castling . ' ';
262 262
 
263
-		if($this->hasMoved[ChessPiece::PAWN][0] != -1) {
263
+		if ($this->hasMoved[ChessPiece::PAWN][0] != -1) {
264 264
 			$fen .= chr(ord('a') + $this->hasMoved[ChessPiece::PAWN][0]);
265
-			switch($this->hasMoved[ChessPiece::PAWN][1]) {
265
+			switch ($this->hasMoved[ChessPiece::PAWN][1]) {
266 266
 				case 3:
267 267
 					$fen .= '6';
268 268
 				break;
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 		else {
275 275
 			$fen .= '-';
276 276
 		}
277
-		$fen .= ' 0 ' . floor(count($this->moves)/2);
277
+		$fen .= ' 0 ' . floor(count($this->moves) / 2);
278 278
 
279 279
 		return $fen;
280 280
 	}
@@ -282,14 +282,14 @@  discard block
 block discarded – undo
282 282
 	private static function parsePieces(array $pieces) {
283 283
 		$board = array();
284 284
 		$row = array();
285
-		for($i=0;$i<8;$i++) {
285
+		for ($i = 0; $i < 8; $i++) {
286 286
 			$row[] = null;
287 287
 		}
288
-		for($i=0;$i<8;$i++) {
288
+		for ($i = 0; $i < 8; $i++) {
289 289
 			$board[] = $row;
290 290
 		}
291
-		foreach($pieces as $piece) {
292
-			if($board[$piece->getY()][$piece->getX()] != null) {
291
+		foreach ($pieces as $piece) {
292
+			if ($board[$piece->getY()][$piece->getX()] != null) {
293 293
 				throw new Exception('Two pieces found in the same tile.');
294 294
 			}
295 295
 			$board[$piece->getY()][$piece->getX()] = $piece;
@@ -300,8 +300,7 @@  discard block
 block discarded – undo
300 300
 	public static function getStandardGame($chessGameID, AbstractSmrPlayer $whitePlayer, AbstractSmrPlayer $blackPlayer) {
301 301
 		$white = $whitePlayer->getAccountID();
302 302
 		$black = $blackPlayer->getAccountID();
303
-		return array
304
-			(
303
+		return array(
305 304
 				new ChessPiece($chessGameID, $black, self::PLAYER_BLACK, ChessPiece::ROOK, 0, 0),
306 305
 				new ChessPiece($chessGameID, $black, self::PLAYER_BLACK, ChessPiece::KNIGHT, 1, 0),
307 306
 				new ChessPiece($chessGameID, $black, self::PLAYER_BLACK, ChessPiece::BISHOP, 2, 0),
@@ -341,7 +340,7 @@  discard block
 block discarded – undo
341 340
 	}
342 341
 
343 342
 	public static function insertNewGame($startDate, $endDate, AbstractSmrPlayer $whitePlayer, AbstractSmrPlayer $blackPlayer) {
344
-		if($startDate == null) {
343
+		if ($startDate == null) {
345 344
 			throw new Exception('Start date cannot be null.');
346 345
 		}
347 346
 
@@ -359,7 +358,7 @@  discard block
 block discarded – undo
359 358
 	private static function insertPieces($chessGameID, AbstractSmrPlayer $whitePlayer, AbstractSmrPlayer $blackPlayer) {
360 359
 		$db = new SmrMySqlDatabase();
361 360
 		$pieces = self::getStandardGame($chessGameID, $whitePlayer, $blackPlayer);
362
-		foreach($pieces as $p) {
361
+		foreach ($pieces as $p) {
363 362
 			$db->query('INSERT INTO chess_game_pieces' .
364 363
 			'(chess_game_id,account_id,piece_id,x,y)' .
365 364
 			'values' .
@@ -371,63 +370,63 @@  discard block
 block discarded – undo
371 370
 		// This move will be set as the most recent move
372 371
 		$this->lastMove = [
373 372
 			'From' => ['X' => $startX, 'Y' => $startY],
374
-			'To'   => ['X' => $endX,   'Y' => $endY],
373
+			'To'   => ['X' => $endX, 'Y' => $endY],
375 374
 		];
376 375
 
377 376
 		$otherPlayerColour = self::getOtherColour($playerColour);
378
-		if($pieceID == ChessPiece::KING) {
377
+		if ($pieceID == ChessPiece::KING) {
379 378
 			$this->hasMoved[$playerColour][ChessPiece::KING] = true;
380 379
 		}
381 380
 		// Check if the piece moving is a rook and mark it as moved to stop castling.
382
-		if($pieceID == ChessPiece::ROOK && ($startX == 0 || $startX == 7) && ($startY == ($playerColour == self::PLAYER_WHITE ? 7 : 0))) {
383
-			$this->hasMoved[$playerColour][ChessPiece::ROOK][$startX==0?'Queen':'King'] = true;
381
+		if ($pieceID == ChessPiece::ROOK && ($startX == 0 || $startX == 7) && ($startY == ($playerColour == self::PLAYER_WHITE ? 7 : 0))) {
382
+			$this->hasMoved[$playerColour][ChessPiece::ROOK][$startX == 0 ? 'Queen' : 'King'] = true;
384 383
 		}
385 384
 		// Check if we've taken a rook and marked them as moved, if they've already moved this does nothing, but if they were taken before moving this stops an issue with trying to castle with a non-existent castle.
386
-		if($pieceTaken == ChessPiece::ROOK && ($endX == 0 || $endX == 7) && $endY == ($otherPlayerColour == self::PLAYER_WHITE ? 7 : 0)) {
387
-			$this->hasMoved[$otherPlayerColour][ChessPiece::ROOK][$endX==0?'Queen':'King'] = true;
385
+		if ($pieceTaken == ChessPiece::ROOK && ($endX == 0 || $endX == 7) && $endY == ($otherPlayerColour == self::PLAYER_WHITE ? 7 : 0)) {
386
+			$this->hasMoved[$otherPlayerColour][ChessPiece::ROOK][$endX == 0 ? 'Queen' : 'King'] = true;
388 387
 		}
389
-		if($pieceID == ChessPiece::PAWN && ($startY == 1 || $startY == 6) && ($endY == 3 || $endY == 4)) {
388
+		if ($pieceID == ChessPiece::PAWN && ($startY == 1 || $startY == 6) && ($endY == 3 || $endY == 4)) {
390 389
 			$this->hasMoved[ChessPiece::PAWN] = array($endX, $endY);
391 390
 		}
392 391
 		else {
393
-			$this->hasMoved[ChessPiece::PAWN] = array(-1,-1);
392
+			$this->hasMoved[ChessPiece::PAWN] = array(-1, -1);
394 393
 		}
395 394
 		return ($castling == 'Queen' ? '0-0-0' : ($castling == 'King' ? '0-0' : ''))
396 395
 			. ChessPiece::getSymbolForPiece($pieceID, $playerColour)
397
-			. chr(ord('a')+$startX)
398
-			. (8-$startY)
396
+			. chr(ord('a') + $startX)
397
+			. (8 - $startY)
399 398
 			. ' '
400 399
 			. ($pieceTaken == null ? '' : ChessPiece::getSymbolForPiece($pieceTaken, $otherPlayerColour))
401
-			. chr(ord('a')+$endX)
402
-			. (8-$endY)
400
+			. chr(ord('a') + $endX)
401
+			. (8 - $endY)
403 402
 			. ($promotionPieceID == null ? '' : ChessPiece::getSymbolForPiece($promotionPieceID, $playerColour))
404 403
 			. ' '
405
-			. ($checking == null ? '' : ($checking == 'CHECK' ? '+' : '++') )
404
+			. ($checking == null ? '' : ($checking == 'CHECK' ? '+' : '++'))
406 405
 			. ($enPassant ? ' e.p.' : '');
407 406
 	}
408 407
 
409 408
 	public function isCheckmated($colour) {
410 409
 		$king = null;
411
-		foreach($this->board as $row) {
412
-			foreach($row as $piece) {
413
-				if($piece != null && $piece->pieceID == ChessPiece::KING && $piece->colour == $colour) {
410
+		foreach ($this->board as $row) {
411
+			foreach ($row as $piece) {
412
+				if ($piece != null && $piece->pieceID == ChessPiece::KING && $piece->colour == $colour) {
414 413
 					$king = $piece;
415 414
 					break;
416 415
 				}
417 416
 			}
418 417
 		}
419
-		if($king == null) {
418
+		if ($king == null) {
420 419
 			throw new Exception('Could not find the king: game id = ' . $this->chessGameID);
421 420
 		}
422
-		if(!self::isPlayerChecked($this->board, $this->getHasMoved(), $colour)) {
421
+		if (!self::isPlayerChecked($this->board, $this->getHasMoved(), $colour)) {
423 422
 			return false;
424 423
 		}
425
-		foreach($this->board as $row) {
426
-			foreach($row as $piece) {
427
-				if($piece != null && $piece->colour == $colour) {
424
+		foreach ($this->board as $row) {
425
+			foreach ($row as $piece) {
426
+				if ($piece != null && $piece->colour == $colour) {
428 427
 					$moves = $piece->getPossibleMoves($this->board, $this->getHasMoved());
429 428
 					//There are moves we can make, we are clearly not checkmated.
430
-					if(count($moves) > 0) {
429
+					if (count($moves) > 0) {
431 430
 						return false;
432 431
 					}
433 432
 				}
@@ -438,15 +437,15 @@  discard block
 block discarded – undo
438 437
 
439 438
 	public static function isCastling($x, $toX) {
440 439
 		$movement = $toX - $x;
441
-		if(abs($movement) == 2) {
440
+		if (abs($movement) == 2) {
442 441
 			//To the left.
443
-			if($movement == -2) {
442
+			if ($movement == -2) {
444 443
 				return array('Type' => 'Queen',
445 444
 						'X' => 0,
446 445
 						'ToX' => 3
447 446
 					);
448 447
 			} //To the right
449
-			else if($movement == 2) {
448
+			else if ($movement == 2) {
450 449
 				return array('Type' => 'King',
451 450
 						'X' => 7,
452 451
 						'ToX' => 5
@@ -457,36 +456,36 @@  discard block
 block discarded – undo
457 456
 	}
458 457
 
459 458
 	public static function movePiece(array &$board, array &$hasMoved, $x, $y, $toX, $toY, $pawnPromotionPiece = ChessPiece::QUEEN) {
460
-		if(!self::isValidCoord($x, $y, $board)) {
459
+		if (!self::isValidCoord($x, $y, $board)) {
461 460
 			throw new Exception('Invalid from coordinates, x=' . $x . ', y=' . $y);
462 461
 		}
463
-		if(!self::isValidCoord($toX, $toY, $board)) {
462
+		if (!self::isValidCoord($toX, $toY, $board)) {
464 463
 			throw new Exception('Invalid to coordinates, x=' . $toX . ', y=' . $toY);
465 464
 		}
466 465
 		$pieceTaken = $board[$toY][$toX];
467 466
 		$board[$toY][$toX] = $board[$y][$x];
468
-		$p =& $board[$toY][$toX];
467
+		$p = & $board[$toY][$toX];
469 468
 		$board[$y][$x] = null;
470
-		if($p == null) {
469
+		if ($p == null) {
471 470
 			throw new Exception('Trying to move non-existent piece: ' . var_export($board, true));
472 471
 		}
473 472
 		$p->setX($toX);
474 473
 		$p->setY($toY);
475 474
 
476 475
 		$oldPawnMovement = $hasMoved[ChessPiece::PAWN];
477
-		$nextPawnMovement = array(-1,-1);
476
+		$nextPawnMovement = array(-1, -1);
478 477
 		$castling = false;
479 478
 		$enPassant = false;
480 479
 		$rookMoved = false;
481 480
 		$rookTaken = false;
482 481
 		$pawnPromotion = false;
483
-		if($p->pieceID == ChessPiece::KING) {
482
+		if ($p->pieceID == ChessPiece::KING) {
484 483
 			//Castling?
485 484
 			$castling = self::isCastling($x, $toX);
486
-			if($castling !== false) {
485
+			if ($castling !== false) {
487 486
 				$hasMoved[$p->colour][ChessPiece::KING] = true;
488 487
 				$hasMoved[$p->colour][ChessPiece::ROOK][$castling['Type']] = true;
489
-				if($board[$y][$castling['X']] == null) {
488
+				if ($board[$y][$castling['X']] == null) {
490 489
 					throw new Exception('Cannot castle with non-existent castle.');
491 490
 				}
492 491
 				$board[$toY][$castling['ToX']] = $board[$y][$castling['X']];
@@ -494,37 +493,37 @@  discard block
 block discarded – undo
494 493
 				$board[$y][$castling['X']] = null;
495 494
 			}
496 495
 		}
497
-		else if($p->pieceID == ChessPiece::PAWN) {
498
-			if($toY == 0 || $toY == 7) {
496
+		else if ($p->pieceID == ChessPiece::PAWN) {
497
+			if ($toY == 0 || $toY == 7) {
499 498
 				$pawnPromotion = $p->promote($pawnPromotionPiece, $board);
500 499
 			}
501 500
 			//Double move to track?
502
-			else if(($y == 1 || $y == 6) && ($toY == 3 || $toY == 4)) {
501
+			else if (($y == 1 || $y == 6) && ($toY == 3 || $toY == 4)) {
503 502
 				$nextPawnMovement = array($toX, $toY);
504 503
 			}
505 504
 			//En passant?
506
-			else if($hasMoved[ChessPiece::PAWN][0] == $toX &&
505
+			else if ($hasMoved[ChessPiece::PAWN][0] == $toX &&
507 506
 					($hasMoved[ChessPiece::PAWN][1] == 3 && $toY == 2 || $hasMoved[ChessPiece::PAWN][1] == 4 && $toY == 5)) {
508 507
 				$enPassant = true;
509 508
 				$pieceTaken = $board[$hasMoved[ChessPiece::PAWN][1]][$hasMoved[ChessPiece::PAWN][0]];
510
-				if($board[$hasMoved[ChessPiece::PAWN][1]][$hasMoved[ChessPiece::PAWN][0]] == null) {
509
+				if ($board[$hasMoved[ChessPiece::PAWN][1]][$hasMoved[ChessPiece::PAWN][0]] == null) {
511 510
 					throw new Exception('Cannot en passant a non-existent pawn.');
512 511
 				}
513 512
 				$board[$hasMoved[ChessPiece::PAWN][1]][$hasMoved[ChessPiece::PAWN][0]] = null;
514 513
 			}
515 514
 		}
516
-		else if($p->pieceID == ChessPiece::ROOK && ($x == 0 || $x == 7) && $y == ($p->colour == self::PLAYER_WHITE ? 7 : 0)) {
515
+		else if ($p->pieceID == ChessPiece::ROOK && ($x == 0 || $x == 7) && $y == ($p->colour == self::PLAYER_WHITE ? 7 : 0)) {
517 516
 			//Rook moved?
518
-			if($hasMoved[$p->colour][ChessPiece::ROOK][$x==0?'Queen':'King'] === false) {
517
+			if ($hasMoved[$p->colour][ChessPiece::ROOK][$x == 0 ? 'Queen' : 'King'] === false) {
519 518
 				// We set rook moved in here as it's used for move info.
520
-				$rookMoved = $x==0?'Queen':'King';
519
+				$rookMoved = $x == 0 ? 'Queen' : 'King';
521 520
 				$hasMoved[$p->colour][ChessPiece::ROOK][$rookMoved] = true;
522 521
 			}
523 522
 		}
524 523
 		// Check if we've taken a rook and marked them as moved, if they've already moved this does nothing, but if they were taken before moving this stops an issue with trying to castle with a non-existent castle.
525
-		if($pieceTaken != null && $pieceTaken->pieceID == ChessPiece::ROOK && ($toX == 0 || $toX == 7) && $toY == ($pieceTaken->colour == self::PLAYER_WHITE ? 7 : 0)) {
526
-			if($hasMoved[$pieceTaken->colour][ChessPiece::ROOK][$toX==0?'Queen':'King'] === false) {
527
-				$rookTaken = $toX==0?'Queen':'King';
524
+		if ($pieceTaken != null && $pieceTaken->pieceID == ChessPiece::ROOK && ($toX == 0 || $toX == 7) && $toY == ($pieceTaken->colour == self::PLAYER_WHITE ? 7 : 0)) {
525
+			if ($hasMoved[$pieceTaken->colour][ChessPiece::ROOK][$toX == 0 ? 'Queen' : 'King'] === false) {
526
+				$rookTaken = $toX == 0 ? 'Queen' : 'King';
528 527
 				$hasMoved[$pieceTaken->colour][ChessPiece::ROOK][$rookTaken] = true;
529 528
 			}
530 529
 		}
@@ -541,18 +540,18 @@  discard block
 block discarded – undo
541 540
 	}
542 541
 
543 542
 	public static function undoMovePiece(array &$board, array &$hasMoved, $x, $y, $toX, $toY, $moveInfo) {
544
-		if(!self::isValidCoord($x, $y, $board)) {
543
+		if (!self::isValidCoord($x, $y, $board)) {
545 544
 			throw new Exception('Invalid from coordinates, x=' . $x . ', y=' . $y);
546 545
 		}
547
-		if(!self::isValidCoord($toX, $toY, $board)) {
546
+		if (!self::isValidCoord($toX, $toY, $board)) {
548 547
 			throw new Exception('Invalid to coordinates, x=' . $toX . ', y=' . $toY);
549 548
 		}
550
-		if($board[$y][$x] != null) {
549
+		if ($board[$y][$x] != null) {
551 550
 			throw new Exception('Undoing move onto another piece? x=' . $x . ', y=' . $y);
552 551
 		}
553 552
 		$board[$y][$x] = $board[$toY][$toX];
554
-		$p =& $board[$y][$x];
555
-		if($p == null) {
553
+		$p = & $board[$y][$x];
554
+		if ($p == null) {
556 555
 			throw new Exception('Trying to undo move of a non-existent piece: ' . var_export($board, true));
557 556
 		}
558 557
 		$board[$toY][$toX] = $moveInfo['PieceTaken'];
@@ -561,12 +560,12 @@  discard block
 block discarded – undo
561 560
 
562 561
 		$hasMoved[ChessPiece::PAWN] = $moveInfo['OldPawnMovement'];
563 562
 		//Castling
564
-		if($p->pieceID == ChessPiece::KING) {
563
+		if ($p->pieceID == ChessPiece::KING) {
565 564
 			$castling = self::isCastling($x, $toX);
566
-			if($castling !== false) {
565
+			if ($castling !== false) {
567 566
 				$hasMoved[$p->colour][ChessPiece::KING] = false;
568 567
 				$hasMoved[$p->colour][ChessPiece::ROOK][$castling['Type']] = false;
569
-				if($board[$toY][$castling['ToX']] == null) {
568
+				if ($board[$toY][$castling['ToX']] == null) {
570 569
 					throw new Exception('Cannot undo castle with non-existent castle.');
571 570
 				}
572 571
 				$board[$y][$castling['X']] = $board[$toY][$castling['ToX']];
@@ -574,25 +573,25 @@  discard block
 block discarded – undo
574 573
 				$board[$toY][$castling['ToX']] = null;
575 574
 			}
576 575
 		}
577
-		else if($moveInfo['EnPassant'] === true) {
576
+		else if ($moveInfo['EnPassant'] === true) {
578 577
 			$board[$toY][$toX] = null;
579 578
 			$board[$hasMoved[ChessPiece::PAWN][1]][$hasMoved[ChessPiece::PAWN][0]] = $moveInfo['PieceTaken'];
580 579
 		}
581
-		else if($moveInfo['RookMoved'] !== false) {
580
+		else if ($moveInfo['RookMoved'] !== false) {
582 581
 			$hasMoved[$p->colour][ChessPiece::ROOK][$moveInfo['RookMoved']] = false;
583 582
 		}
584
-		if($moveInfo['RookTaken'] !== false) {
583
+		if ($moveInfo['RookTaken'] !== false) {
585 584
 			$hasMoved[$moveInfo['PieceTaken']->colour][ChessPiece::ROOK][$moveInfo['RookTaken']] = false;
586 585
 		}
587 586
 	}
588 587
 
589 588
 	public function tryAlgebraicMove($move) {
590
-		if(strlen($move) != 4 && strlen($move) != 5) {
589
+		if (strlen($move) != 4 && strlen($move) != 5) {
591 590
 			throw new Exception('Move of length "' . strlen($move) . '" is not valid, full move: ' . $move);
592 591
 		}
593 592
 		$aVal = ord('a');
594 593
 		$hVal = ord('h');
595
-		if(ord($move[0]) < $aVal || ord($move[2]) < $aVal
594
+		if (ord($move[0]) < $aVal || ord($move[2]) < $aVal
596 595
 				|| ord($move[0]) > $hVal || ord($move[2]) > $hVal
597 596
 				|| $move[1] < 1 || $move[3] < 1
598 597
 				|| $move[1] > 8 || $move[3] > 8) {
@@ -603,73 +602,73 @@  discard block
 block discarded – undo
603 602
 		$toX = ord($move[2]) - $aVal;
604 603
 		$toY = 8 - $move[3];
605 604
 		$pawnPromotionPiece = null;
606
-		if(isset($move[4])) {
605
+		if (isset($move[4])) {
607 606
 			$pawnPromotionPiece = ChessPiece::getPieceForLetter($move[4]);
608 607
 		}
609 608
 		return $this->tryMove($x, $y, $toX, $toY, $this->getCurrentTurnAccountID(), $pawnPromotionPiece);
610 609
 	}
611 610
 
612 611
 	public function tryMove($x, $y, $toX, $toY, $forAccountID, $pawnPromotionPiece) {
613
-		if($this->hasEnded()) {
612
+		if ($this->hasEnded()) {
614 613
 			return 5;
615 614
 		}
616
-		if($this->getCurrentTurnAccountID() != $forAccountID) {
615
+		if ($this->getCurrentTurnAccountID() != $forAccountID) {
617 616
 			return 4;
618 617
 		}
619 618
 		$lastTurnPlayer = $this->getCurrentTurnPlayer();
620 619
 		$this->getBoard();
621 620
 		$p = $this->board[$y][$x];
622
-		if($p == null || $p->colour != $this->getColourForAccountID($forAccountID)) {
621
+		if ($p == null || $p->colour != $this->getColourForAccountID($forAccountID)) {
623 622
 			return 2;
624 623
 		}
625 624
 
626 625
 		$moves = $p->getPossibleMoves($this->board, $this->getHasMoved(), $forAccountID);
627
-		foreach($moves as $move) {
628
-			if($move[0]==$toX && $move[1]==$toY) {
626
+		foreach ($moves as $move) {
627
+			if ($move[0] == $toX && $move[1] == $toY) {
629 628
 				$chessType = $this->isNPCGame() ? 'Chess (NPC)' : 'Chess';
630 629
 				$currentPlayer = $this->getCurrentTurnPlayer();
631 630
 
632 631
 				$moveInfo = ChessGame::movePiece($this->board, $this->getHasMoved(), $x, $y, $toX, $toY, $pawnPromotionPiece);
633 632
 
634 633
 				//We have taken the move, we should refresh $p
635
-				$p =& $this->board[$toY][$toX];
634
+				$p = & $this->board[$toY][$toX];
636 635
 
637 636
 				$pieceTakenID = null;
638
-				if($moveInfo['PieceTaken'] != null) {
637
+				if ($moveInfo['PieceTaken'] != null) {
639 638
 					$pieceTakenID = $moveInfo['PieceTaken']->pieceID;
640
-					if($moveInfo['PieceTaken']->pieceID == ChessPiece::KING) {
639
+					if ($moveInfo['PieceTaken']->pieceID == ChessPiece::KING) {
641 640
 						throw new Exception('King was taken.');
642 641
 					}
643 642
 				}
644 643
 
645 644
 				$pieceID = $p->pieceID;
646 645
 				$pieceNo = $p->pieceNo;
647
-				if($moveInfo['PawnPromotion'] !== false) {
646
+				if ($moveInfo['PawnPromotion'] !== false) {
648 647
 					$p->pieceID = $moveInfo['PawnPromotion']['PieceID'];
649 648
 					$p->pieceNo = $moveInfo['PawnPromotion']['PieceNo'];
650 649
 				}
651 650
 
652 651
 				$checking = null;
653
-				if($p->isAttacking($this->board, $this->getHasMoved(), true)) {
652
+				if ($p->isAttacking($this->board, $this->getHasMoved(), true)) {
654 653
 					$checking = 'CHECK';
655 654
 				}
656
-				if($this->isCheckmated(self::getOtherColour($p->colour))) {
655
+				if ($this->isCheckmated(self::getOtherColour($p->colour))) {
657 656
 					$checking = 'MATE';
658 657
 				}
659
-				if($this->moves!=null) {
658
+				if ($this->moves != null) {
660 659
 					$this->moves[] = $this->createMove($pieceID, $x, $y, $toX, $toY, $pieceTakenID, $checking, $this->getCurrentTurnColour(), $moveInfo['Castling']['Type'], $moveInfo['EnPassant'], $moveInfo['PawnPromotion'] === false ? null : $moveInfo['PawnPromotion']['PieceID']);
661 660
 				}
662
-				if(self::isPlayerChecked($this->board, $this->getHasMoved(), $p->colour)) {
661
+				if (self::isPlayerChecked($this->board, $this->getHasMoved(), $p->colour)) {
663 662
 					return 3;
664 663
 				}
665 664
 
666 665
 				$otherPlayer = $this->getCurrentTurnPlayer();
667
-				if($moveInfo['PawnPromotion'] !== false) {
666
+				if ($moveInfo['PawnPromotion'] !== false) {
668 667
 					$piecePromotedSymbol = $p->getPieceSymbol();
669
-					$currentPlayer->increaseHOF(1, array($chessType,'Moves','Own Pawns Promoted','Total'), HOF_PUBLIC);
670
-					$otherPlayer->increaseHOF(1, array($chessType,'Moves','Opponent Pawns Promoted','Total'), HOF_PUBLIC);
671
-					$currentPlayer->increaseHOF(1, array($chessType,'Moves','Own Pawns Promoted',$piecePromotedSymbol), HOF_PUBLIC);
672
-					$otherPlayer->increaseHOF(1, array($chessType,'Moves','Opponent Pawns Promoted',$piecePromotedSymbol), HOF_PUBLIC);
668
+					$currentPlayer->increaseHOF(1, array($chessType, 'Moves', 'Own Pawns Promoted', 'Total'), HOF_PUBLIC);
669
+					$otherPlayer->increaseHOF(1, array($chessType, 'Moves', 'Opponent Pawns Promoted', 'Total'), HOF_PUBLIC);
670
+					$currentPlayer->increaseHOF(1, array($chessType, 'Moves', 'Own Pawns Promoted', $piecePromotedSymbol), HOF_PUBLIC);
671
+					$otherPlayer->increaseHOF(1, array($chessType, 'Moves', 'Opponent Pawns Promoted', $piecePromotedSymbol), HOF_PUBLIC);
673 672
 				}
674 673
 
675 674
 				$castlingType = $moveInfo['Castling'] === false ? null : $moveInfo['Castling']['Type'];
@@ -679,37 +678,37 @@  discard block
 block discarded – undo
679 678
 								(' . $this->db->escapeNumber($p->chessGameID) . ',' . $this->db->escapeNumber($pieceID) . ',' . $this->db->escapeNumber($x) . ',' . $this->db->escapeNumber($y) . ',' . $this->db->escapeNumber($toX) . ',' . $this->db->escapeNumber($toY) . ',' . $this->db->escapeString($checking, true, true) . ',' . ($moveInfo['PieceTaken'] == null ? 'NULL' : $this->db->escapeNumber($moveInfo['PieceTaken']->pieceID)) . ',' . $this->db->escapeString($castlingType, true, true) . ',' . $this->db->escapeBoolean($moveInfo['EnPassant']) . ',' . ($moveInfo['PawnPromotion'] == false ? 'NULL' : $this->db->escapeNumber($moveInfo['PawnPromotion']['PieceID'])) . ');');
680 679
 
681 680
 
682
-				$currentPlayer->increaseHOF(1, array($chessType,'Moves','Total Taken'), HOF_PUBLIC);
683
-				if($moveInfo['PieceTaken'] != null) {
681
+				$currentPlayer->increaseHOF(1, array($chessType, 'Moves', 'Total Taken'), HOF_PUBLIC);
682
+				if ($moveInfo['PieceTaken'] != null) {
684 683
 					$this->db->query('DELETE FROM chess_game_pieces
685 684
 									WHERE chess_game_id=' . $this->db->escapeNumber($this->chessGameID) . ' AND account_id=' . $this->db->escapeNumber($moveInfo['PieceTaken']->accountID) . ' AND piece_id=' . $this->db->escapeNumber($moveInfo['PieceTaken']->pieceID) . ' AND piece_no=' . $this->db->escapeNumber($moveInfo['PieceTaken']->pieceNo) . ';');
686 685
 
687 686
 					$pieceTakenSymbol = $moveInfo['PieceTaken']->getPieceSymbol();
688
-					$currentPlayer->increaseHOF(1, array($chessType,'Moves','Opponent Pieces Taken','Total'), HOF_PUBLIC);
689
-					$otherPlayer->increaseHOF(1, array($chessType,'Moves','Own Pieces Taken','Total'), HOF_PUBLIC);
690
-					$currentPlayer->increaseHOF(1, array($chessType,'Moves','Opponent Pieces Taken',$pieceTakenSymbol), HOF_PUBLIC);
691
-					$otherPlayer->increaseHOF(1, array($chessType,'Moves','Own Pieces Taken',$pieceTakenSymbol), HOF_PUBLIC);
687
+					$currentPlayer->increaseHOF(1, array($chessType, 'Moves', 'Opponent Pieces Taken', 'Total'), HOF_PUBLIC);
688
+					$otherPlayer->increaseHOF(1, array($chessType, 'Moves', 'Own Pieces Taken', 'Total'), HOF_PUBLIC);
689
+					$currentPlayer->increaseHOF(1, array($chessType, 'Moves', 'Opponent Pieces Taken', $pieceTakenSymbol), HOF_PUBLIC);
690
+					$otherPlayer->increaseHOF(1, array($chessType, 'Moves', 'Own Pieces Taken', $pieceTakenSymbol), HOF_PUBLIC);
692 691
 				}
693 692
 				$this->db->query('UPDATE chess_game_pieces
694 693
 							SET x=' . $this->db->escapeNumber($toX) . ', y=' . $this->db->escapeNumber($toY) .
695 694
 								($moveInfo['PawnPromotion'] !== false ? ', piece_id=' . $this->db->escapeNumber($moveInfo['PawnPromotion']['PieceID']) . ', piece_no=' . $this->db->escapeNumber($moveInfo['PawnPromotion']['PieceNo']) : '') . '
696 695
 							WHERE chess_game_id=' . $this->db->escapeNumber($this->chessGameID) . ' AND account_id=' . $this->db->escapeNumber($p->accountID) . ' AND piece_id=' . $this->db->escapeNumber($pieceID) . ' AND piece_no=' . $this->db->escapeNumber($pieceNo) . ';');
697
-				if($moveInfo['Castling'] !== false) {
696
+				if ($moveInfo['Castling'] !== false) {
698 697
 					$this->db->query('UPDATE chess_game_pieces
699 698
 								SET x=' . $this->db->escapeNumber($moveInfo['Castling']['ToX']) . '
700 699
 								WHERE chess_game_id=' . $this->db->escapeNumber($this->chessGameID) . ' AND account_id=' . $this->db->escapeNumber($p->accountID) . ' AND x = ' . $this->db->escapeNumber($moveInfo['Castling']['X']) . ' AND y = ' . $this->db->escapeNumber($y) . ';');
701 700
 				}
702 701
 				$return = 0;
703
-				if($checking == 'MATE') {
702
+				if ($checking == 'MATE') {
704 703
 					$this->setWinner($forAccountID);
705 704
 					$return = 1;
706 705
 					SmrPlayer::sendMessageFromCasino($lastTurnPlayer->getGameID(), $this->getCurrentTurnAccountID(), 'You have just lost [chess=' . $this->getChessGameID() . '] against [player=' . $lastTurnPlayer->getPlayerID() . '].');
707 706
 				}
708 707
 				else {
709 708
 					SmrPlayer::sendMessageFromCasino($lastTurnPlayer->getGameID(), $this->getCurrentTurnAccountID(), 'It is now your turn in [chess=' . $this->getChessGameID() . '] against [player=' . $lastTurnPlayer->getPlayerID() . '].');
710
-					if($checking == 'CHECK') {
711
-						$currentPlayer->increaseHOF(1, array($chessType,'Moves','Check Given'), HOF_PUBLIC);
712
-						$otherPlayer->increaseHOF(1, array($chessType,'Moves','Check Received'), HOF_PUBLIC);
709
+					if ($checking == 'CHECK') {
710
+						$currentPlayer->increaseHOF(1, array($chessType, 'Moves', 'Check Given'), HOF_PUBLIC);
711
+						$otherPlayer->increaseHOF(1, array($chessType, 'Moves', 'Check Received'), HOF_PUBLIC);
713 712
 					}
714 713
 				}
715 714
 				$currentPlayer->saveHOF();
@@ -748,10 +747,10 @@  discard block
 block discarded – undo
748 747
 	}
749 748
 
750 749
 	public function getColourID($colour) {
751
-		if($colour == self::PLAYER_WHITE) {
750
+		if ($colour == self::PLAYER_WHITE) {
752 751
 			return $this->getWhiteID();
753 752
 		}
754
-		if($colour == self::PLAYER_BLACK) {
753
+		if ($colour == self::PLAYER_BLACK) {
755 754
 			return $this->getBlackID();
756 755
 		}
757 756
 	}
@@ -761,10 +760,10 @@  discard block
 block discarded – undo
761 760
 	}
762 761
 
763 762
 	public function getColourForAccountID($accountID) {
764
-		if($accountID == $this->getWhiteID()) {
763
+		if ($accountID == $this->getWhiteID()) {
765 764
 			return self::PLAYER_WHITE;
766 765
 		}
767
-		if($accountID == $this->getBlackID()) {
766
+		if ($accountID == $this->getBlackID()) {
768 767
 			return self::PLAYER_BLACK;
769 768
 		}
770 769
 		return false;
@@ -792,8 +791,8 @@  discard block
 block discarded – undo
792 791
 		$winningPlayer = $this->getColourPlayer($winnerColour);
793 792
 		$losingPlayer = $this->getColourPlayer(self::getOtherColour($winnerColour));
794 793
 		$chessType = $this->isNPCGame() ? 'Chess (NPC)' : 'Chess';
795
-		$winningPlayer->increaseHOF(1, array($chessType,'Games','Won'), HOF_PUBLIC);
796
-		$losingPlayer->increaseHOF(1, array($chessType,'Games','Lost'), HOF_PUBLIC);
794
+		$winningPlayer->increaseHOF(1, array($chessType, 'Games', 'Won'), HOF_PUBLIC);
795
+		$losingPlayer->increaseHOF(1, array($chessType, 'Games', 'Lost'), HOF_PUBLIC);
797 796
 		return array('Winner' => $winningPlayer, 'Loser' => $losingPlayer);
798 797
 	}
799 798
 
@@ -834,21 +833,21 @@  discard block
 block discarded – undo
834 833
 	}
835 834
 
836 835
 	public static function getOtherColour($colour) {
837
-		if($colour == self::PLAYER_WHITE) {
836
+		if ($colour == self::PLAYER_WHITE) {
838 837
 			return self::PLAYER_BLACK;
839 838
 		}
840
-		if($colour == self::PLAYER_BLACK) {
839
+		if ($colour == self::PLAYER_BLACK) {
841 840
 			return self::PLAYER_WHITE;
842 841
 		}
843 842
 		return false;
844 843
 	}
845 844
 
846 845
 	public function resign($accountID) {
847
-		if($this->hasEnded() || !$this->getColourForAccountID($accountID)) {
846
+		if ($this->hasEnded() || !$this->getColourForAccountID($accountID)) {
848 847
 			return false;
849 848
 		}
850 849
 		// If only 1 person has moved then just end the game.
851
-		if(count($this->getMoves()) < 2) {
850
+		if (count($this->getMoves()) < 2) {
852 851
 			$this->endDate = TIME;
853 852
 			$this->db->query('UPDATE chess_game
854 853
 							SET end_time=' . $this->db->escapeNumber(TIME) . '
@@ -860,17 +859,17 @@  discard block
 block discarded – undo
860 859
 			$winnerAccountID = $this->getColourID(self::getOtherColour($loserColour));
861 860
 			$results = $this->setWinner($winnerAccountID);
862 861
 			$chessType = $this->isNPCGame() ? 'Chess (NPC)' : 'Chess';
863
-			$results['Loser']->increaseHOF(1, array($chessType,'Games','Resigned'), HOF_PUBLIC);
862
+			$results['Loser']->increaseHOF(1, array($chessType, 'Games', 'Resigned'), HOF_PUBLIC);
864 863
 			SmrPlayer::sendMessageFromCasino($results['Winner']->getGameID(), $results['Winner']->getPlayerID(), '[player=' . $results['Loser']->getPlayerID() . '] just resigned against you in [chess=' . $this->getChessGameID() . '].');
865 864
 			return 0;
866 865
 		}
867 866
 	}
868 867
 
869 868
 	public function getPlayGameHREF() {
870
-		return SmrSession::getNewHREF(create_container('skeleton.php','chess_play.php',array('ChessGameID' => $this->chessGameID)));
869
+		return SmrSession::getNewHREF(create_container('skeleton.php', 'chess_play.php', array('ChessGameID' => $this->chessGameID)));
871 870
 	}
872 871
 
873 872
 	public function getResignHREF() {
874
-		return SmrSession::getNewHREF(create_container('skeleton.php','chess_resign_processing.php',array('ChessGameID' => $this->chessGameID)));
873
+		return SmrSession::getNewHREF(create_container('skeleton.php', 'chess_resign_processing.php', array('ChessGameID' => $this->chessGameID)));
875 874
 	}
876 875
 }
Please login to merge, or discard this patch.
lib/Default/SmrPlanet.class.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -707,7 +707,7 @@
 block discarded – undo
707 707
 		if ($buildingTypeID === false) {
708 708
 			$structs = $this->typeInfo::STRUCTURES;
709 709
 			return array_combine(array_keys($structs),
710
-			                     array_column($structs, 'max_amount'));
710
+								 array_column($structs, 'max_amount'));
711 711
 		}
712 712
 		return $this->getStructureTypes($buildingTypeID)->maxAmount();
713 713
 	}
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
 		$results['DeadBeforeShot'] = false;
1147 1147
 		$weapons = $this->getWeapons();
1148 1148
 		foreach ($weapons as $orderID => $weapon) {
1149
-			$results['Weapons'][$orderID] =& $weapon->shootPlayerAsPlanet($this, $targetPlayers[array_rand($targetPlayers)]);
1149
+			$results['Weapons'][$orderID] = & $weapon->shootPlayerAsPlanet($this, $targetPlayers[array_rand($targetPlayers)]);
1150 1150
 			if ($results['Weapons'][$orderID]['Hit']) {
1151 1151
 				$results['TotalDamage'] += $results['Weapons'][$orderID]['ActualDamage']['TotalDamage'];
1152 1152
 				$results['TotalDamagePerTargetPlayer'][$results['Weapons'][$orderID]['TargetPlayer']->getAccountID()] += $results['Weapons'][$orderID]['ActualDamage']['TotalDamage'];
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
 		}
1155 1155
 		if ($this->hasCDs()) {
1156 1156
 			$thisCDs = new SmrCombatDrones($this->getGameID(), $this->getCDs(), true);
1157
-			$results['Drones'] =& $thisCDs->shootPlayerAsPlanet($this, $targetPlayers[array_rand($targetPlayers)]);
1157
+			$results['Drones'] = & $thisCDs->shootPlayerAsPlanet($this, $targetPlayers[array_rand($targetPlayers)]);
1158 1158
 			$results['TotalDamage'] += $results['Drones']['ActualDamage']['TotalDamage'];
1159 1159
 			$results['TotalDamagePerTargetPlayer'][$results['Drones']['TargetPlayer']->getAccountID()] += $results['Drones']['ActualDamage']['TotalDamage'];
1160 1160
 		}
Please login to merge, or discard this patch.
lib/Default/SmrPlayer.class.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@
 block discarded – undo
197 197
 		while ($this->db->nextRecord()) {
198 198
 			try {
199 199
 				$otherPlayer = SmrPlayer::getPlayer($this->db->getInt('from_account_id'),
200
-				                                    $this->getGameID(), $forceUpdate);
200
+													$this->getGameID(), $forceUpdate);
201 201
 			} catch (PlayerNotFoundException $e) {
202 202
 				// Skip players that have not joined this game
203 203
 				continue;
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	/**
208 208
 	 * Insert a new player into the database. Returns the new player object.
209 209
 	 */
210
-	public static function createPlayer($accountID, $gameID, $playerName, $raceID, $isNewbie, $npc=false) {
210
+	public static function createPlayer($accountID, $gameID, $playerName, $raceID, $isNewbie, $npc = false) {
211 211
 		// Put the player in a sector with an HQ
212 212
 		$startSectorID = self::getHome($gameID, $raceID);
213 213
 
@@ -1163,13 +1163,13 @@  discard block
 block discarded – undo
1163 1163
 			$this->db->query('SELECT type,amount FROM player_hof WHERE ' . $this->SQL);
1164 1164
 			$this->HOF = array();
1165 1165
 			while ($this->db->nextRecord()) {
1166
-				$hof =& $this->HOF;
1166
+				$hof = & $this->HOF;
1167 1167
 				$typeList = explode(':', $this->db->getField('type'));
1168 1168
 				foreach ($typeList as $type) {
1169 1169
 					if (!isset($hof[$type])) {
1170 1170
 						$hof[$type] = array();
1171 1171
 					}
1172
-					$hof =& $hof[$type];
1172
+					$hof = & $hof[$type];
1173 1173
 				}
1174 1174
 				$hof = $this->db->getFloat('amount');
1175 1175
 			}
@@ -1611,7 +1611,7 @@  discard block
 block discarded – undo
1611 1611
 			create_error('The saved sector must be in the box!');
1612 1612
 		}
1613 1613
 
1614
-		$storedDestinations =& $this->getStoredDestinations();
1614
+		$storedDestinations = & $this->getStoredDestinations();
1615 1615
 		foreach ($storedDestinations as &$sd) {
1616 1616
 			if ($sd['SectorID'] == $sectorID) {
1617 1617
 				$sd['OffsetTop'] = $offsetTop;
Please login to merge, or discard this patch.
lib/Default/DummyPlayer.class.php 2 patches
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,8 +53,9 @@  discard block
 block discarded – undo
53 53
 	}
54 54
 	
55 55
 	public function setAllianceID($ID) {
56
-		if($this->allianceID == $ID)
57
-			return;
56
+		if($this->allianceID == $ID) {
57
+					return;
58
+		}
58 59
 		$this->allianceID=$ID;
59 60
 	}
60 61
 	
@@ -93,8 +94,7 @@  discard block
 block discarded – undo
93 94
 		if($db->nextRecord()) {
94 95
 			$return = unserialize($db->getField('info'));
95 96
 			return $return;
96
-		}
97
-		else {
97
+		} else {
98 98
 			$return = new DummyPlayer();
99 99
 			return $return;
100 100
 		}
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,31 +1,31 @@  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
 		parent::__construct();
6 6
 		$this->accountID				= 0;
7
-		$this->gameID					= (int) $gameID;
8
-		$this->playerName				= (string) $playerName;
7
+		$this->gameID = (int)$gameID;
8
+		$this->playerName = (string)$playerName;
9 9
 		$this->playerID					= 0;
10 10
 		$this->sectorID					= 0;
11
-		$this->lastSectorID				= 0;
11
+		$this->lastSectorID = 0;
12 12
 		$this->turns					= 1000;
13
-		$this->newbieTurns				= 0;
13
+		$this->newbieTurns = 0;
14 14
 		$this->lastNewsUpdate			= 0;
15 15
 		$this->dead						= false;
16 16
 		$this->landedOnPlanet			= false;
17
-		$this->lastActive				= 0;
18
-		$this->lastCPLAction			= 0;
19
-		$this->raceID					= (int) $raceID;
20
-		$this->credits					= 0;
21
-		$this->experience				= (int) $experience;
22
-		$this->alignment				= (int) $alignment;
23
-		$this->militaryPayment			= 0;
24
-		$this->allianceID				= (int) $allianceID;
25
-		$this->shipID					= (int) $shipTypeID;
17
+		$this->lastActive = 0;
18
+		$this->lastCPLAction = 0;
19
+		$this->raceID = (int)$raceID;
20
+		$this->credits = 0;
21
+		$this->experience				= (int)$experience;
22
+		$this->alignment = (int)$alignment;
23
+		$this->militaryPayment = 0;
24
+		$this->allianceID				= (int)$allianceID;
25
+		$this->shipID					= (int)$shipTypeID;
26 26
 		$this->kills					= 0;
27 27
 		$this->deaths					= 0;
28
-		$this->lastPort					= 0;
28
+		$this->lastPort = 0;
29 29
 		$this->bank						= 0;
30 30
 		$this->zoom						= 0;
31 31
 		
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	}
54 54
 	
55 55
 	public function setAllianceID($ID) {
56
-		if($this->allianceID == $ID)
56
+		if ($this->allianceID == $ID)
57 57
 			return;
58
-		$this->allianceID=$ID;
58
+		$this->allianceID = $ID;
59 59
 	}
60 60
 	
61 61
 	public function &killPlayerByPlayer(AbstractSmrPlayer $killer) {
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		$db = new SmrMySqlDatabase();
82 82
 		$db->query('REPLACE INTO cached_dummys ' .
83 83
 					'(type, id, info) ' .
84
-					'VALUES (\'DummyPlayer\', '.$db->escapeString($this->getPlayerName()).', '.$db->escapeString($cache).')');	
84
+					'VALUES (\'DummyPlayer\', ' . $db->escapeString($this->getPlayerName()) . ', ' . $db->escapeString($cache) . ')');	
85 85
 		 unserialize($cache);
86 86
 	}
87 87
 	
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		$db->query('SELECT info FROM cached_dummys
91 91
 					WHERE type = \'DummyPlayer\'
92 92
 						AND id = ' . $db->escapeString($name) . ' LIMIT 1');
93
-		if($db->nextRecord()) {
93
+		if ($db->nextRecord()) {
94 94
 			$return = unserialize($db->getField('info'));
95 95
 			return $return;
96 96
 		}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		$db->query('SELECT id FROM cached_dummys
106 106
 					WHERE type = \'DummyPlayer\'');
107 107
 		$dummyNames = array();
108
-		while($db->nextRecord()) {
108
+		while ($db->nextRecord()) {
109 109
 			$dummyNames[] = $db->getField('id');
110 110
 		}
111 111
 		return $dummyNames;
Please login to merge, or discard this patch.
lib/Default/SocialLogins/Twitter.class.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 		}
36 36
 		$helper = self::getTwitterObj($_SESSION['TwitterToken']);
37 37
 		$accessToken = $helper->oauth('oauth/access_token',
38
-		                              ['oauth_verifier' => $_REQUEST['oauth_verifier']]);
38
+									  ['oauth_verifier' => $_REQUEST['oauth_verifier']]);
39 39
 		$auth = self::getTwitterObj($accessToken);
40 40
 		$userInfo = $auth->get('account/verify_credentials', ['include_email' => 'true']);
41 41
 		if ($auth->getLastHttpCode() == 200) {
Please login to merge, or discard this patch.
htdocs/login.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,6 @@
 block discarded – undo
50 50
 	$template->assign('Body', 'login/login.php');
51 51
 	$template->display('login/skeleton.php');
52 52
 
53
-}
54
-catch (Throwable $e) {
53
+} catch (Throwable $e) {
55 54
 	handleException($e);
56 55
 }
Please login to merge, or discard this patch.
engine/Default/chat_sharing.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 	$shareFrom[$fromAccountId] = array(
20 20
 		'Player ID'   => $otherPlayer == null ? '-' : $otherPlayer->getPlayerID(),
21 21
 		'Player Name' => $otherPlayer == null ?
22
-		                 '<b>Account</b>: ' . SmrAccount::getAccount($fromAccountId)->getHofDisplayName() :
23
-		                 $otherPlayer->getPlayerName(),
22
+						 '<b>Account</b>: ' . SmrAccount::getAccount($fromAccountId)->getHofDisplayName() :
23
+						 $otherPlayer->getPlayerName(),
24 24
 		'All Games'   => $gameId == 0 ? '<span class="green">YES</span>' : '<span class="red">NO</span>',
25 25
 		'Game ID'     => $gameId,
26 26
 	);
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 	$shareTo[$toAccountId] = array(
41 41
 		'Player ID'   => $otherPlayer == null ? '-' : $otherPlayer->getPlayerID(),
42 42
 		'Player Name' => $otherPlayer == null ?
43
-		                 '<b>Account</b>: ' . SmrAccount::getAccount($toAccountId)->getHofDisplayName() :
44
-		                 $otherPlayer->getPlayerName(),
43
+						 '<b>Account</b>: ' . SmrAccount::getAccount($toAccountId)->getHofDisplayName() :
44
+						 $otherPlayer->getPlayerName(),
45 45
 		'All Games'   => $gameId == 0 ? '<span class="green">YES</span>' : '<span class="red">NO</span>',
46 46
 		'Game ID'     => $gameId,
47 47
 	);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@  discard block
 block discarded – undo
19 19
 	$shareFrom[$fromAccountId] = array(
20 20
 		'Player ID'   => $otherPlayer == null ? '-' : $otherPlayer->getPlayerID(),
21 21
 		'Player Name' => $otherPlayer == null ?
22
-		                 '<b>Account</b>: ' . SmrAccount::getAccount($fromAccountId)->getHofDisplayName() :
23
-		                 $otherPlayer->getPlayerName(),
22
+		                 '<b>Account</b>: ' . SmrAccount::getAccount($fromAccountId)->getHofDisplayName() : $otherPlayer->getPlayerName(),
24 23
 		'All Games'   => $gameId == 0 ? '<span class="green">YES</span>' : '<span class="red">NO</span>',
25 24
 		'Game ID'     => $gameId,
26 25
 	);
@@ -40,8 +39,7 @@  discard block
 block discarded – undo
40 39
 	$shareTo[$toAccountId] = array(
41 40
 		'Player ID'   => $otherPlayer == null ? '-' : $otherPlayer->getPlayerID(),
42 41
 		'Player Name' => $otherPlayer == null ?
43
-		                 '<b>Account</b>: ' . SmrAccount::getAccount($toAccountId)->getHofDisplayName() :
44
-		                 $otherPlayer->getPlayerName(),
42
+		                 '<b>Account</b>: ' . SmrAccount::getAccount($toAccountId)->getHofDisplayName() : $otherPlayer->getPlayerName(),
45 43
 		'All Games'   => $gameId == 0 ? '<span class="green">YES</span>' : '<span class="red">NO</span>',
46 44
 		'Game ID'     => $gameId,
47 45
 	);
Please login to merge, or discard this patch.