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 (#812)
by Dan
04:25
created
engine/Default/hall_of_fame_player_detail.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@
 block discarded – undo
20 20
 const USER_SCORE_NAME = 'User Score';
21 21
 $hofTypes = array(DONATION_NAME=>true, USER_SCORE_NAME=>true);
22 22
 while ($db->nextRecord()) {
23
-	$hof =& $hofTypes;
23
+	$hof = & $hofTypes;
24 24
 	$typeList = explode(':', $db->getField('type'));
25 25
 	foreach ($typeList as $type) {
26 26
 		if (!isset($hof[$type])) {
27 27
 			$hof[$type] = array();
28 28
 		}
29
-		$hof =& $hof[$type];
29
+		$hof = & $hof[$type];
30 30
 	}
31 31
 	$hof = true;
32 32
 }
Please login to merge, or discard this patch.
htdocs/weapon_list.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 	$weapons = [];
12 12
 	$db->query('SELECT * FROM weapon_type JOIN race USING(race_id)');
13 13
 	while ($db->nextRecord()) {
14
-		switch($db->getInt('buyer_restriction')) {
14
+		switch ($db->getInt('buyer_restriction')) {
15 15
 			case BUYER_RESTRICTION_GOOD:
16 16
 				$restriction = '<span class="dgreen">Good</span>';
17 17
 			break;
@@ -46,15 +46,15 @@  discard block
 block discarded – undo
46 46
 
47 47
 	$template->display('weapon_list.php');
48 48
 }
49
-catch(Throwable $e) {
49
+catch (Throwable $e) {
50 50
 	handleException($e);
51 51
 }
52 52
 
53 53
 function buildSelector($db, $name, $table) {
54 54
 	$selector = '<select onchange="filterSelect(this)"><option>All</option>';
55
-	$db->query("SELECT DISTINCT ".$name." FROM ".$table." ORDER BY ".$name);
55
+	$db->query("SELECT DISTINCT " . $name . " FROM " . $table . " ORDER BY " . $name);
56 56
 	while ($db->nextRecord()) {
57
-		$selector .= '<option>'.$db->getField($name).'</option>';
57
+		$selector .= '<option>' . $db->getField($name) . '</option>';
58 58
 	}
59 59
 	$selector .= '</select>';
60 60
 	return $selector;
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 	foreach (Globals::getRaces() as $raceID => $raceData) {
67 67
 		$raceName = $raceData['Race Name'];
68 68
 		$racebox .= '
69
-			<input type="checkbox" id="race'.$raceID.'" name="races" value="'.$raceName.'" onClick="raceToggle()">
70
-			<label for="race'.$raceID.'" class="race'.$raceID.'">'.$raceName.'</label>&thinsp;';
69
+			<input type="checkbox" id="race'.$raceID . '" name="races" value="' . $raceName . '" onClick="raceToggle()">
70
+			<label for="race'.$raceID . '" class="race' . $raceID . '">' . $raceName . '</label>&thinsp;';
71 71
 	}
72 72
 	$racebox .= '</form>';
73 73
 	return $racebox;
Please login to merge, or discard this patch.
htdocs/ship_list.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 	$template->display('ship_list.php');
19 19
 }
20
-catch(Throwable $e) {
20
+catch (Throwable $e) {
21 21
 	handleException($e);
22 22
 }
23 23
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	$selector = '<select onchange="filterSelect(this)"><option>All</option>';
26 26
 	$db->query('SELECT DISTINCT ' . $name . ' FROM ' . $table . ' ORDER BY ' . $name);
27 27
 	while ($db->nextRecord()) {
28
-		$selector .= '<option>'.$db->getField($name).'</option>';
28
+		$selector .= '<option>' . $db->getField($name) . '</option>';
29 29
 	}
30 30
 	$selector .= '</select>';
31 31
 	return $selector;
Please login to merge, or discard this patch.
lib/Default/ChessPiece.class.php 1 patch
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 	}
53 53
 	
54 54
 	public function isAttacking(array &$board, array &$hasMoved, $king, $x = -1, $y = -1) {
55
-		$moves =& $this->getPossibleMoves($board, $hasMoved, null, true);
56
-		foreach($moves as &$move) {
57
-			$p =& $board[$move[1]][$move[0]];
58
-			if(($move[0] == $x && $move[1] == $y) || ($king === true && $p != null && $p->pieceID == self::KING && $this->colour != $p->colour)) {
55
+		$moves = & $this->getPossibleMoves($board, $hasMoved, null, true);
56
+		foreach ($moves as &$move) {
57
+			$p = & $board[$move[1]][$move[0]];
58
+			if (($move[0] == $x && $move[1] == $y) || ($king === true && $p != null && $p->pieceID == self::KING && $this->colour != $p->colour)) {
59 59
 				return true;
60 60
 			}
61 61
 		}
@@ -64,130 +64,130 @@  discard block
 block discarded – undo
64 64
 
65 65
 	public function &getPossibleMoves(array &$board, array &$hasMoved, $forAccountID = null, $attackingCheck = false) {
66 66
 		$moves = array();
67
-		if($forAccountID == null || $this->accountID == $forAccountID) {
68
-			if($this->pieceID==self::PAWN) {
69
-				$dirY = $this->colour==ChessGame::PLAYER_BLACK ? 1 : -1;
70
-				$moveY = $this->y+$dirY;
67
+		if ($forAccountID == null || $this->accountID == $forAccountID) {
68
+			if ($this->pieceID == self::PAWN) {
69
+				$dirY = $this->colour == ChessGame::PLAYER_BLACK ? 1 : -1;
70
+				$moveY = $this->y + $dirY;
71 71
 				//Pawn forward movement is not attacking - so don't check it if doing an attacking check.
72
-				if(!$attackingCheck) {
73
-					if(ChessGame::isValidCoord($this->x, $moveY, $board) && $board[$moveY][$this->x] == null && $this->isSafeMove($board, $hasMoved, $this->x, $moveY)) {
74
-						$moves[] = array($this->x,$moveY);
72
+				if (!$attackingCheck) {
73
+					if (ChessGame::isValidCoord($this->x, $moveY, $board) && $board[$moveY][$this->x] == null && $this->isSafeMove($board, $hasMoved, $this->x, $moveY)) {
74
+						$moves[] = array($this->x, $moveY);
75 75
 					}
76 76
 					$doubleMoveY = $moveY + $dirY;
77
-					if($this->y-$dirY == 0 || $this->y-$dirY*2 == count($board)) { //Double move first move
78
-						if($board[$moveY][$this->x] == null && $board[$doubleMoveY][$this->x] == null && $this->isSafeMove($board, $hasMoved, $this->x, $doubleMoveY)) {
79
-							$moves[] = array($this->x,$doubleMoveY);
77
+					if ($this->y - $dirY == 0 || $this->y - $dirY * 2 == count($board)) { //Double move first move
78
+						if ($board[$moveY][$this->x] == null && $board[$doubleMoveY][$this->x] == null && $this->isSafeMove($board, $hasMoved, $this->x, $doubleMoveY)) {
79
+							$moves[] = array($this->x, $doubleMoveY);
80 80
 						}
81 81
 					}
82 82
 				}
83
-				for($i=-1;$i<2;$i+=2) {
84
-					$moveX = $this->x+$i;
85
-					if(ChessGame::isValidCoord($moveX, $moveY, $board)) {
86
-						if($attackingCheck || 
83
+				for ($i = -1; $i < 2; $i += 2) {
84
+					$moveX = $this->x + $i;
85
+					if (ChessGame::isValidCoord($moveX, $moveY, $board)) {
86
+						if ($attackingCheck || 
87 87
 							((($hasMoved[ChessPiece::PAWN][0] == $moveX && $hasMoved[ChessPiece::PAWN][1] == $this->y) || 
88
-							($board[$moveY][$moveX] != null && $board[$moveY][$moveX]->colour!=$this->colour))
88
+							($board[$moveY][$moveX] != null && $board[$moveY][$moveX]->colour != $this->colour))
89 89
 							&& $this->isSafeMove($board, $hasMoved, $moveX, $moveY))) {
90
-							$moves[] = array($moveX,$moveY);
90
+							$moves[] = array($moveX, $moveY);
91 91
 						}
92 92
 					}
93 93
 				}
94 94
 			}
95
-			else if($this->pieceID==self::KING) {
96
-				for($i = -1; $i < 2; $i++) {
97
-					for($j = -1; $j < 2; $j++) {
98
-						if($i!=0 || $j!=0) {
99
-							$this->addMove($this->x+$i, $this->y+$j, $board, $moves, $hasMoved, $attackingCheck);
95
+			else if ($this->pieceID == self::KING) {
96
+				for ($i = -1; $i < 2; $i++) {
97
+					for ($j = -1; $j < 2; $j++) {
98
+						if ($i != 0 || $j != 0) {
99
+							$this->addMove($this->x + $i, $this->y + $j, $board, $moves, $hasMoved, $attackingCheck);
100 100
 						}
101 101
 					}
102 102
 				}
103 103
 				//Castling is not attacking - so don't check it if doing an attacking check.
104
-				if(!$attackingCheck && !$hasMoved[$this->colour][ChessPiece::KING] && !ChessGame::isPlayerChecked($board, $hasMoved, $this->colour)) {
105
-					if(!$hasMoved[$this->colour][ChessPiece::ROOK]['Queen'] && 
106
-							ChessGame::isValidCoord($this->x-1, $this->y, $board) && $board[$this->y][$this->x-1] == null &&
107
-							ChessGame::isValidCoord($this->x-3, $this->y, $board) && $board[$this->y][$this->x-3] == null &&
108
-							$this->isSafeMove($board, $hasMoved, $this->x-1, $this->y)) {
109
-						$this->addMove($this->x-2, $this->y, $board, $moves, $hasMoved, $attackingCheck);
104
+				if (!$attackingCheck && !$hasMoved[$this->colour][ChessPiece::KING] && !ChessGame::isPlayerChecked($board, $hasMoved, $this->colour)) {
105
+					if (!$hasMoved[$this->colour][ChessPiece::ROOK]['Queen'] && 
106
+							ChessGame::isValidCoord($this->x - 1, $this->y, $board) && $board[$this->y][$this->x - 1] == null &&
107
+							ChessGame::isValidCoord($this->x - 3, $this->y, $board) && $board[$this->y][$this->x - 3] == null &&
108
+							$this->isSafeMove($board, $hasMoved, $this->x - 1, $this->y)) {
109
+						$this->addMove($this->x - 2, $this->y, $board, $moves, $hasMoved, $attackingCheck);
110 110
 					}
111
-					if(!$hasMoved[$this->colour][ChessPiece::ROOK]['King'] &&
112
-							ChessGame::isValidCoord($this->x+1, $this->y, $board) && $board[$this->y][$this->x+1] == null &&
113
-							$this->isSafeMove($board, $hasMoved, $this->x+1, $this->y)) {
114
-						$this->addMove($this->x+2, $this->y, $board, $moves, $hasMoved, $attackingCheck);
111
+					if (!$hasMoved[$this->colour][ChessPiece::ROOK]['King'] &&
112
+							ChessGame::isValidCoord($this->x + 1, $this->y, $board) && $board[$this->y][$this->x + 1] == null &&
113
+							$this->isSafeMove($board, $hasMoved, $this->x + 1, $this->y)) {
114
+						$this->addMove($this->x + 2, $this->y, $board, $moves, $hasMoved, $attackingCheck);
115 115
 					}
116 116
 				}
117 117
 			}
118
-			else if($this->pieceID==self::QUEEN) {
118
+			else if ($this->pieceID == self::QUEEN) {
119 119
 				$moveX = $this->x;
120 120
 				$moveY = $this->y;
121
-				while($this->addMove(--$moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Left
121
+				while ($this->addMove(--$moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Left
122 122
 				$moveX = $this->x;
123 123
 				$moveY = $this->y;
124
-				while($this->addMove(++$moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Right
124
+				while ($this->addMove(++$moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Right
125 125
 				$moveX = $this->x;
126 126
 				$moveY = $this->y;
127
-				while($this->addMove($moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up
127
+				while ($this->addMove($moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up
128 128
 				$moveX = $this->x;
129 129
 				$moveY = $this->y;
130
-				while($this->addMove($moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Down
130
+				while ($this->addMove($moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Down
131 131
 				$moveX = $this->x;
132 132
 				$moveY = $this->y;
133
-				while($this->addMove(--$moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Left
133
+				while ($this->addMove(--$moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Left
134 134
 				$moveX = $this->x;
135 135
 				$moveY = $this->y;
136
-				while($this->addMove(++$moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Right
136
+				while ($this->addMove(++$moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Right
137 137
 				$moveX = $this->x;
138 138
 				$moveY = $this->y;
139
-				while($this->addMove(--$moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Down-Left
139
+				while ($this->addMove(--$moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Down-Left
140 140
 				$moveX = $this->x;
141 141
 				$moveY = $this->y;
142
-				while($this->addMove(++$moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Left
142
+				while ($this->addMove(++$moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Left
143 143
 			}
144
-			else if($this->pieceID==self::ROOK) {
144
+			else if ($this->pieceID == self::ROOK) {
145 145
 				$moveX = $this->x;
146 146
 				$moveY = $this->y;
147
-				while($this->addMove(--$moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Left
147
+				while ($this->addMove(--$moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Left
148 148
 				$moveX = $this->x;
149 149
 				$moveY = $this->y;
150
-				while($this->addMove(++$moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Right
150
+				while ($this->addMove(++$moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Right
151 151
 				$moveX = $this->x;
152 152
 				$moveY = $this->y;
153
-				while($this->addMove($moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up
153
+				while ($this->addMove($moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up
154 154
 				$moveX = $this->x;
155 155
 				$moveY = $this->y;
156
-				while($this->addMove($moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Down
156
+				while ($this->addMove($moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Down
157 157
 			}
158
-			else if($this->pieceID==self::BISHOP) {
158
+			else if ($this->pieceID == self::BISHOP) {
159 159
 				$moveX = $this->x;
160 160
 				$moveY = $this->y;
161
-				while($this->addMove(--$moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Left
161
+				while ($this->addMove(--$moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Left
162 162
 				$moveX = $this->x;
163 163
 				$moveY = $this->y;
164
-				while($this->addMove(++$moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Right
164
+				while ($this->addMove(++$moveX, --$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Right
165 165
 				$moveX = $this->x;
166 166
 				$moveY = $this->y;
167
-				while($this->addMove(--$moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Down-Left
167
+				while ($this->addMove(--$moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Down-Left
168 168
 				$moveX = $this->x;
169 169
 				$moveY = $this->y;
170
-				while($this->addMove(++$moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Left
170
+				while ($this->addMove(++$moveX, ++$moveY, $board, $moves, $hasMoved, $attackingCheck) && $board[$moveY][$moveX] == null); //Up-Left
171 171
 			}
172
-			else if($this->pieceID==self::KNIGHT) {
173
-				$moveX = $this->x-1;
174
-				$moveY = $this->y-2;
175
-				$this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck);//2up-left
172
+			else if ($this->pieceID == self::KNIGHT) {
173
+				$moveX = $this->x - 1;
174
+				$moveY = $this->y - 2;
175
+				$this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck); //2up-left
176 176
 				$moveX += 2;
177
-				$this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck);//2up-right
178
-				$moveY = $this->y+2;
179
-				$this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck);//2down-right
177
+				$this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck); //2up-right
178
+				$moveY = $this->y + 2;
179
+				$this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck); //2down-right
180 180
 				$moveX -= 2;
181
-				$this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck);//2down-left
182
-				$moveX = $this->x-2;
183
-				$moveY = $this->y-1;
184
-				$this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck);//2left-up
181
+				$this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck); //2down-left
182
+				$moveX = $this->x - 2;
183
+				$moveY = $this->y - 1;
184
+				$this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck); //2left-up
185 185
 				$moveY += 2;
186
-				$this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck);//2left-down
187
-				$moveX = $this->x+2;
188
-				$this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck);//2right-down
186
+				$this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck); //2left-down
187
+				$moveX = $this->x + 2;
188
+				$this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck); //2right-down
189 189
 				$moveY -= 2;
190
-				$this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck);//2right-up
190
+				$this->addMove($moveX, $moveY, $board, $moves, $hasMoved, $attackingCheck); //2right-up
191 191
 			}
192 192
 		}
193 193
 		
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 	}
196 196
 	
197 197
 	private function addMove($toX, $toY, array &$board, array &$moves, array &$hasMoved = null, $attackingCheck = true) {
198
-		if(ChessGame::isValidCoord($toX, $toY, $board)) {
199
-			if(($board[$toY][$toX] == null || $board[$toY][$toX]->colour!=$this->colour)) {
198
+		if (ChessGame::isValidCoord($toX, $toY, $board)) {
199
+			if (($board[$toY][$toX] == null || $board[$toY][$toX]->colour != $this->colour)) {
200 200
 				//We can only actually move to this position if it is safe to do so, however we can pass through it looking for a safe move so we still want to return true.
201
-				if(($attackingCheck == true || $this->isSafeMove($board, $hasMoved, $toX, $toY))) {
202
-					$moves[] = array($toX,$toY);
201
+				if (($attackingCheck == true || $this->isSafeMove($board, $hasMoved, $toX, $toY))) {
202
+					$moves[] = array($toX, $toY);
203 203
 				}
204 204
 				return true;
205 205
 			}
@@ -208,30 +208,30 @@  discard block
 block discarded – undo
208 208
 	}
209 209
 	
210 210
 	public function promote($pawnPromotionPieceID, array &$board) {
211
-		if($pawnPromotionPieceID==null) {
211
+		if ($pawnPromotionPieceID == null) {
212 212
 			throw new Exception('Promotion piece cannot be null on a promote.');
213 213
 		}
214 214
 		$takenNos = array();
215
-		foreach($board as $row) {
216
-			foreach($row as $piece) {
217
-				if($piece != null && $piece->pieceID == $pawnPromotionPieceID && $piece->colour == $this->colour) {
215
+		foreach ($board as $row) {
216
+			foreach ($row as $piece) {
217
+				if ($piece != null && $piece->pieceID == $pawnPromotionPieceID && $piece->colour == $this->colour) {
218 218
 					$takenNos[$piece->pieceNo] = true;
219 219
 				}
220 220
 			}
221 221
 		}
222
-		$i=0;
223
-		while(isset($takenNos[$i])) {
222
+		$i = 0;
223
+		while (isset($takenNos[$i])) {
224 224
 			$i++;
225 225
 		}
226 226
 		return array('PieceID' => $pawnPromotionPieceID, 'PieceNo' => $i);
227 227
 	}
228 228
 
229 229
 	public function getPieceLetter() {
230
-		return self::getLetterForPiece($this->pieceID,$this->colour);
230
+		return self::getLetterForPiece($this->pieceID, $this->colour);
231 231
 	}
232 232
 
233 233
 	public function getPieceSymbol() {
234
-		return self::getSymbolForPiece($this->pieceID,$this->colour);
234
+		return self::getSymbolForPiece($this->pieceID, $this->colour);
235 235
 	}
236 236
 
237 237
 	public static function getSymbolForPiece($pieceID, $colour) {
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	}
240 240
 
241 241
 	public static function getLetterForPiece($pieceID, $colour) {
242
-		switch($pieceID) {
242
+		switch ($pieceID) {
243 243
 			case self::KING:
244 244
 				$letter = 'k';
245 245
 			break;
@@ -260,14 +260,14 @@  discard block
 block discarded – undo
260 260
 				$letter = 'p';
261 261
 			break;
262 262
 		}
263
-		if($colour == ChessGame::PLAYER_WHITE) {
263
+		if ($colour == ChessGame::PLAYER_WHITE) {
264 264
 			$letter = strtoupper($letter);
265 265
 		}
266 266
 		return $letter;
267 267
 	}
268 268
 
269 269
 	public static function getPieceForLetter($letter) {
270
-		switch($letter) {
270
+		switch ($letter) {
271 271
 			case 'k':
272 272
 			case 'K':
273 273
 				return self::KING;
Please login to merge, or discard this patch.
lib/Default/SmrForce.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -446,20 +446,20 @@
 block discarded – undo
446 446
 
447 447
 		if ($this->hasMines()) {
448 448
 			$thisMines = new SmrMines($this->getGameID(), $this->getMines());
449
-			$results['Results']['Mines'] =& $thisMines->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)], $minesAreAttacker);
449
+			$results['Results']['Mines'] = & $thisMines->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)], $minesAreAttacker);
450 450
 			$results['TotalDamage'] += $results['Results']['Mines']['ActualDamage']['TotalDamage'];
451 451
 		}
452 452
 
453 453
 		if ($this->hasCDs()) {
454 454
 			$thisCDs = new SmrCombatDrones($this->getGameID(), $this->getCDs());
455
-			$results['Results']['Drones'] =& $thisCDs->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)]);
455
+			$results['Results']['Drones'] = & $thisCDs->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)]);
456 456
 			$results['TotalDamage'] += $results['Results']['Drones']['ActualDamage']['TotalDamage'];
457 457
 		}
458 458
 
459 459
 		if (!$minesAreAttacker) {
460 460
 			if ($this->hasSDs()) {
461 461
 				$thisSDs = new SmrScoutDrones($this->getGameID(), $this->getSDs());
462
-				$results['Results']['Scouts'] =& $thisSDs->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)]);
462
+				$results['Results']['Scouts'] = & $thisSDs->shootPlayerAsForce($this, $targetPlayers[array_rand($targetPlayers)]);
463 463
 				$results['TotalDamage'] += $results['Results']['Scouts']['ActualDamage']['TotalDamage'];
464 464
 			}
465 465
 		}
Please login to merge, or discard this patch.
lib/Default/Menu.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.
lib/Default/SmrPlanetType.class.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	/**
41 41
 	 * Access properties of structures that this planet type can build.
42 42
 	 */
43
-	public function structureTypes($structureID=false) {
43
+	public function structureTypes($structureID = false) {
44 44
 		if (!isset($this->structures)) {
45 45
 			foreach (static::STRUCTURES as $ID => $Info) {
46 46
 				$this->structures[$ID] = new SmrPlanetStructureType($ID, $Info);
@@ -77,12 +77,12 @@  discard block
 block discarded – undo
77 77
 			'exp_gain' => 540,
78 78
 		],
79 79
 	];
80
-	public function name()         { return "Terran Planet"; }
81
-	public function imageLink()    { return "images/planet1.png"; }
82
-	public function description()  { return "A lush world, with forests, seas, sweeping meadows, and indigenous lifeforms."; }
80
+	public function name() { return "Terran Planet"; }
81
+	public function imageLink() { return "images/planet1.png"; }
82
+	public function description() { return "A lush world, with forests, seas, sweeping meadows, and indigenous lifeforms."; }
83 83
 	public function maxAttackers() { return 10; }
84
-	public function maxLanded()    { return self::MAX_LANDED_UNLIMITED; }
85
-	public function menuOptions()  { return self::DEFAULT_MENU_OPTIONS; }
84
+	public function maxLanded() { return self::MAX_LANDED_UNLIMITED; }
85
+	public function menuOptions() { return self::DEFAULT_MENU_OPTIONS; }
86 86
 }
87 87
 
88 88
 class AridPlanet extends SmrPlanetType {
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
 			'exp_gain' => 180,
107 107
 		],
108 108
 	];
109
-	public function name()         { return "Arid Planet"; }
110
-	public function imageLink()    { return "images/planet2.png"; }
111
-	public function description()  { return "A world mostly devoid of surface water, but capable of supporting life."; }
109
+	public function name() { return "Arid Planet"; }
110
+	public function imageLink() { return "images/planet2.png"; }
111
+	public function description() { return "A world mostly devoid of surface water, but capable of supporting life."; }
112 112
 	public function maxAttackers() { return 5; }
113
-	public function maxLanded()    { return 5; }
114
-	public function menuOptions()  { return ['CONSTRUCTION', 'DEFENSE', 'STOCKPILE', 'OWNERSHIP']; }
113
+	public function maxLanded() { return 5; }
114
+	public function menuOptions() { return ['CONSTRUCTION', 'DEFENSE', 'STOCKPILE', 'OWNERSHIP']; }
115 115
 }
116 116
 
117 117
 class DwarfPlanet extends SmrPlanetType {
@@ -135,12 +135,12 @@  discard block
 block discarded – undo
135 135
 			'exp_gain' => 540,
136 136
 		],
137 137
 	];
138
-	public function name()         { return "Dwarf Planet"; }
139
-	public function imageLink()    { return "images/planet3.png"; }
140
-	public function description()  { return "A smaller than usual planet, with no native life present."; }
138
+	public function name() { return "Dwarf Planet"; }
139
+	public function imageLink() { return "images/planet3.png"; }
140
+	public function description() { return "A smaller than usual planet, with no native life present."; }
141 141
 	public function maxAttackers() { return 5; }
142
-	public function maxLanded()    { return self::MAX_LANDED_UNLIMITED; }
143
-	public function menuOptions()  { return self::DEFAULT_MENU_OPTIONS; }
142
+	public function maxLanded() { return self::MAX_LANDED_UNLIMITED; }
143
+	public function menuOptions() { return self::DEFAULT_MENU_OPTIONS; }
144 144
 }
145 145
 
146 146
 class ProtoPlanet extends SmrPlanetType {
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
 			'exp_gain' => 540,
171 171
 		],
172 172
 	];
173
-	public function name()         { return "Protoplanet"; }
174
-	public function imageLink()    { return "images/planet5.png"; }
175
-	public function description()  { return "A developing planet, not yet able to support the infrastructure of advanced technologies."; }
173
+	public function name() { return "Protoplanet"; }
174
+	public function imageLink() { return "images/planet5.png"; }
175
+	public function description() { return "A developing planet, not yet able to support the infrastructure of advanced technologies."; }
176 176
 	public function maxAttackers() { return 5; }
177
-	public function maxLanded()    { return 5; }
178
-	public function menuOptions()  { return self::DEFAULT_MENU_OPTIONS; }
177
+	public function maxLanded() { return 5; }
178
+	public function menuOptions() { return self::DEFAULT_MENU_OPTIONS; }
179 179
 }
180 180
 
181 181
 class DefenseWorld extends SmrPlanetType {
@@ -205,10 +205,10 @@  discard block
 block discarded – undo
205 205
 			'exp_gain' => 9,
206 206
 		],
207 207
 	];
208
-	public function name()         { return "Defense World"; }
209
-	public function imageLink()    { return "images/planet4.png"; }
210
-	public function description()  { return "A fully armed and operational battle station loaded with excessive firepower."; }
208
+	public function name() { return "Defense World"; }
209
+	public function imageLink() { return "images/planet4.png"; }
210
+	public function description() { return "A fully armed and operational battle station loaded with excessive firepower."; }
211 211
 	public function maxAttackers() { return 10; }
212
-	public function maxLanded()    { return self::MAX_LANDED_UNLIMITED; }
213
-	public function menuOptions()  { return self::DEFAULT_MENU_OPTIONS; }
212
+	public function maxLanded() { return self::MAX_LANDED_UNLIMITED; }
213
+	public function menuOptions() { return self::DEFAULT_MENU_OPTIONS; }
214 214
 }
Please login to merge, or discard this patch.
lib/Default/Sorter.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 	private static $reverseOrder;
5 5
 
6 6
 	private static function cmpStrProp($a, $b) {
7
-		return (self::$reverseOrder?-1:1)*strcasecmp($a->{self::$sortKey}, $b->{self::$sortKey});
7
+		return (self::$reverseOrder ?-1 : 1) * strcasecmp($a->{self::$sortKey}, $b->{self::$sortKey});
8 8
 	}
9 9
 
10 10
 	private static function cmpNumElement($a, $b) {
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 	}
21 21
 
22 22
 	public static function cmpNum($a, $b) {
23
-		if($a == $b) return 0;
24
-		return (self::$reverseOrder?-1:1)*($a < $b ? -1 : 1);
23
+		if ($a == $b) return 0;
24
+		return (self::$reverseOrder ?-1 : 1) * ($a < $b ? -1 : 1);
25 25
 	}
26 26
 
27 27
 	public static function sortByStrProp(array &$array, $property, $reverseOrder = false) {
Please login to merge, or discard this patch.
lib/Default/AbstractSmrPort.class.php 1 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.