Completed
Push — master ( 2340fb...76470b )
by Tomáš
02:24
created
src/TournamentGenerator/Group.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -58,7 +58,9 @@  discard block
 block discarded – undo
58 58
 	public function getTeams(bool $ordered = false, $ordering = \TournamentGenerator\Constants::POINTS, array $filters = []) {
59 59
 		$teams = $this->teams;
60 60
 
61
-		if ($ordered) return $this->sortTeams($ordering, $filters);
61
+		if ($ordered) {
62
+			return $this->sortTeams($ordering, $filters);
63
+		}
62 64
 
63 65
 		// APPLY FILTERS
64 66
 		$filter = new Filter([$this], $filters);
@@ -73,7 +75,9 @@  discard block
 block discarded – undo
73 75
 		return $t;
74 76
 	}
75 77
 	public function sortTeams($ordering = null, array $filters = []) {
76
-		if (!isset($ordering)) $ordering = $this->ordering;
78
+		if (!isset($ordering)) {
79
+			$ordering = $this->ordering;
80
+		}
77 81
 		$this->teams = Utilis\Sorter\Teams::sortGroup($this->teams, $this, $ordering);
78 82
 		return $this->getTeams(false, null, $filters);
79 83
 	}
@@ -146,7 +150,9 @@  discard block
 block discarded – undo
146 150
 	}
147 151
 
148 152
 	public function setOrdering(string $ordering = \TournamentGenerator\Constants::POINTS) {
149
-		if (!in_array($ordering, \TournamentGenerator\Constants::OrderingTypes)) throw new \Exception('Unknown group ordering: '.$ordering);
153
+		if (!in_array($ordering, \TournamentGenerator\Constants::OrderingTypes)) {
154
+			throw new \Exception('Unknown group ordering: '.$ordering);
155
+		}
150 156
 		$this->ordering = $ordering;
151 157
 		return $this;
152 158
 	}
@@ -202,7 +208,9 @@  discard block
 block discarded – undo
202 208
 	}
203 209
 	public function addGame(...$games){
204 210
 		array_walk_recursive($games, function($game){
205
-			if ($game instanceof Game) $this->games[] = $game;
211
+			if ($game instanceof Game) {
212
+				$this->games[] = $game;
213
+			}
206 214
 		});
207 215
 		return $this;
208 216
 	}
@@ -210,7 +218,9 @@  discard block
 block discarded – undo
210 218
 		return $this->games;
211 219
 	}
212 220
 	public function orderGames() {
213
-		if (count($this->games) <= 4) return $this->games;
221
+		if (count($this->games) <= 4) {
222
+			return $this->games;
223
+		}
214 224
 		$this->games = $this->generator->orderGames();
215 225
 		return $this->games;
216 226
 	}
@@ -225,7 +235,9 @@  discard block
 block discarded – undo
225 235
 		return $this;
226 236
 	}
227 237
 	public function isPlayed(){
228
-		if (count($this->games) === 0) return false;
238
+		if (count($this->games) === 0) {
239
+			return false;
240
+		}
229 241
 		return count(array_filter($this->games, function($a){return $a->isPlayed();})) !== 0;
230 242
 	}
231 243
 
Please login to merge, or discard this patch.