Completed
Push — master ( 2340fb...76470b )
by Tomáš
02:24
created
src/TournamentGenerator/Group.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
 		$this->setId(isset($id) ? $id : uniqid());
29 29
 	}
30 30
 
31
-	public function allowSkip(){
31
+	public function allowSkip() {
32 32
 		$this->generator->allowSkip();
33 33
 		return $this;
34 34
 	}
35
-	public function disallowSkip(){
35
+	public function disallowSkip() {
36 36
 		$this->generator->disallowSkip();
37 37
 		return $this;
38 38
 	}
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	}
46 46
 
47 47
 	public function addTeam(...$teams) {
48
-		\array_walk_recursive($teams, function($team){
48
+		\array_walk_recursive($teams, function($team) {
49 49
 			$this->setTeam($team);
50 50
 		});
51 51
 		return $this;
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 		return $this;
179 179
 	}
180 180
 	public function addProgressed(...$teams) {
181
-		$this->progressed = array_merge($this->progressed, array_map(function ($a) {return $a->getId();}, array_filter($teams, function($a){return $a instanceof Team;})));
182
-		foreach (array_filter($teams, function($a){return is_array($a);}) as $team) {
183
-			$this->progressed = array_merge($this->progressed, array_map(function ($a) {return $a->getId();}, array_filter($team, function($a) {
181
+		$this->progressed = array_merge($this->progressed, array_map(function($a) {return $a->getId(); }, array_filter($teams, function($a) {return $a instanceof Team; })));
182
+		foreach (array_filter($teams, function($a) {return is_array($a); }) as $team) {
183
+			$this->progressed = array_merge($this->progressed, array_map(function($a) {return $a->getId(); }, array_filter($team, function($a) {
184 184
 				return ($a instanceof Team);
185 185
 			})));
186 186
 		}
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
 		$this->games[] = $g;
201 201
 		return $g;
202 202
 	}
203
-	public function addGame(...$games){
204
-		array_walk_recursive($games, function($game){
203
+	public function addGame(...$games) {
204
+		array_walk_recursive($games, function($game) {
205 205
 			if ($game instanceof Game) $this->games[] = $game;
206 206
 		});
207 207
 		return $this;
@@ -224,9 +224,9 @@  discard block
 block discarded – undo
224 224
 		}
225 225
 		return $this;
226 226
 	}
227
-	public function isPlayed(){
227
+	public function isPlayed() {
228 228
 		if (count($this->games) === 0) return false;
229
-		return count(array_filter($this->games, function($a){return $a->isPlayed();})) !== 0;
229
+		return count(array_filter($this->games, function($a) {return $a->isPlayed(); })) !== 0;
230 230
 	}
231 231
 
232 232
 }
Please login to merge, or discard this 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.