@@ -30,14 +30,18 @@ discard block |
||
30 | 30 | foreach ($settings as $key => $value) { |
31 | 31 | switch ($key) { |
32 | 32 | case 'name': |
33 | - if (gettype($value) !== 'string') throw new \Exception('Expected string as group name '.gettype($value).' given'); |
|
33 | + if (gettype($value) !== 'string') { |
|
34 | + throw new \Exception('Expected string as group name '.gettype($value).' given'); |
|
35 | + } |
|
34 | 36 | $this->name = $value; |
35 | 37 | break; |
36 | 38 | case 'type': |
37 | 39 | $this->generator->setType($value); |
38 | 40 | break; |
39 | 41 | case 'ordering': |
40 | - if (!in_array($value, orderingTypes)) throw new \Exception('Unknown group ordering: '.$value); |
|
42 | + if (!in_array($value, orderingTypes)) { |
|
43 | + throw new \Exception('Unknown group ordering: '.$value); |
|
44 | + } |
|
41 | 45 | $this->ordering = $value; |
42 | 46 | break; |
43 | 47 | case 'inGame': |
@@ -45,7 +49,9 @@ discard block |
||
45 | 49 | break; |
46 | 50 | case 'maxSize': |
47 | 51 | $value = (int) $value; |
48 | - if ($value > 1) $this->generator->setMaxSize($value); |
|
52 | + if ($value > 1) { |
|
53 | + $this->generator->setMaxSize($value); |
|
54 | + } |
|
49 | 55 | break; |
50 | 56 | case 'order': |
51 | 57 | $this->order = (int) $value; |
@@ -87,10 +93,11 @@ discard block |
||
87 | 93 | 'second' => 0, |
88 | 94 | 'third' => 0 |
89 | 95 | ]; |
90 | - } |
|
91 | - elseif (gettype($team) === 'array') { |
|
96 | + } elseif (gettype($team) === 'array') { |
|
92 | 97 | foreach ($team as $team2) { |
93 | - if ($team2 instanceof Team) $this->teams[] = $team2; |
|
98 | + if ($team2 instanceof Team) { |
|
99 | + $this->teams[] = $team2; |
|
100 | + } |
|
94 | 101 | $team2->groupResults[$this->id] = [ |
95 | 102 | 'group' => $this, |
96 | 103 | 'points' => 0, |
@@ -102,16 +109,20 @@ discard block |
||
102 | 109 | 'third' => 0 |
103 | 110 | ]; |
104 | 111 | } |
112 | + } else { |
|
113 | + throw new \Exception('Trying to add team which is not an instance of Team class'); |
|
105 | 114 | } |
106 | - else throw new \Exception('Trying to add team which is not an instance of Team class'); |
|
107 | 115 | } |
108 | 116 | return $this; |
109 | 117 | } |
110 | 118 | public function getTeams($filters = []) { |
111 | 119 | $teams = $this->teams; |
112 | 120 | |
113 | - if (gettype($filters) !== 'array' && $filters instanceof TeamFilter) $filters = [$filters]; |
|
114 | - elseif (gettype($filters) !== 'array') $filters = []; |
|
121 | + if (gettype($filters) !== 'array' && $filters instanceof TeamFilter) { |
|
122 | + $filters = [$filters]; |
|
123 | + } elseif (gettype($filters) !== 'array') { |
|
124 | + $filters = []; |
|
125 | + } |
|
115 | 126 | |
116 | 127 | // APPLY FILTERS |
117 | 128 | foreach ($filters as $key => $filter) { |
@@ -119,27 +130,31 @@ discard block |
||
119 | 130 | switch (strtolower($key)) { |
120 | 131 | case 'and': |
121 | 132 | foreach ($teams as $tkey => $team) { |
122 | - if (!$this->filterAnd($team, $filter)) unset($teams[$tkey]); // IF FILTER IS NOT VALIDATED REMOVE TEAM FROM RETURN ARRAY |
|
133 | + if (!$this->filterAnd($team, $filter)) { |
|
134 | + unset($teams[$tkey]); |
|
135 | + } |
|
136 | + // IF FILTER IS NOT VALIDATED REMOVE TEAM FROM RETURN ARRAY |
|
123 | 137 | } |
124 | 138 | break; |
125 | 139 | case 'or': |
126 | 140 | foreach ($teams as $tkey => $team) { |
127 | - if (!$this->filterOr($team, $filter)) unset($teams[$tkey]); // IF FILTER IS NOT VALIDATED REMOVE TEAM FROM RETURN ARRAY |
|
141 | + if (!$this->filterOr($team, $filter)) { |
|
142 | + unset($teams[$tkey]); |
|
143 | + } |
|
144 | + // IF FILTER IS NOT VALIDATED REMOVE TEAM FROM RETURN ARRAY |
|
128 | 145 | } |
129 | 146 | break; |
130 | 147 | default: |
131 | 148 | throw new \Exception('Unknown opperand type "'.$key.'". Expected "and" or "or".'); |
132 | 149 | break; |
133 | 150 | } |
134 | - } |
|
135 | - elseif ($filter instanceof TeamFilter) { |
|
151 | + } elseif ($filter instanceof TeamFilter) { |
|
136 | 152 | foreach ($teams as $tkey => $team) { |
137 | 153 | if (!$filter->validate($team, $this->id, 'sum', $this)) { |
138 | 154 | unset($teams[$tkey]); // IF FILTER IS NOT VALIDATED REMOVE TEAM FROM RETURN ARRAY |
139 | 155 | } |
140 | 156 | } |
141 | - } |
|
142 | - else { |
|
157 | + } else { |
|
143 | 158 | throw new \Exception('Filer ['.$key.'] is not an instance of TeamFilter class'); |
144 | 159 | } |
145 | 160 | } |
@@ -161,18 +176,26 @@ discard block |
||
161 | 176 | return $t; |
162 | 177 | } |
163 | 178 | public function sortTeams($filters = [], $ordering = null) { |
164 | - if (!isset($ordering)) $ordering = $this->ordering; |
|
179 | + if (!isset($ordering)) { |
|
180 | + $ordering = $this->ordering; |
|
181 | + } |
|
165 | 182 | switch ($ordering) { |
166 | 183 | case \POINTS:{ |
167 | 184 | usort($this->teams, function($a, $b) { |
168 | - if ($a->groupResults[$this->id]["points"] === $b->groupResults[$this->id]["points"] && $a->groupResults[$this->id]["score"] === $b->groupResults[$this->id]["score"]) return 0; |
|
169 | - if ($a->groupResults[$this->id]["points"] === $b->groupResults[$this->id]["points"]) return ($a->groupResults[$this->id]["score"] > $b->groupResults[$this->id]["score"] ? -1 : 1); |
|
185 | + if ($a->groupResults[$this->id]["points"] === $b->groupResults[$this->id]["points"] && $a->groupResults[$this->id]["score"] === $b->groupResults[$this->id]["score"]) { |
|
186 | + return 0; |
|
187 | + } |
|
188 | + if ($a->groupResults[$this->id]["points"] === $b->groupResults[$this->id]["points"]) { |
|
189 | + return ($a->groupResults[$this->id]["score"] > $b->groupResults[$this->id]["score"] ? -1 : 1); |
|
190 | + } |
|
170 | 191 | return ($a->groupResults[$this->id]["points"] > $b->groupResults[$this->id]["points"] ? -1 : 1); |
171 | 192 | }); |
172 | 193 | break;} |
173 | 194 | case \SCORE:{ |
174 | 195 | usort($this->teams, function($a, $b) { |
175 | - if ($a->groupResults[$this->id]["score"] === $b->groupResults[$this->id]["score"]) return 0; |
|
196 | + if ($a->groupResults[$this->id]["score"] === $b->groupResults[$this->id]["score"]) { |
|
197 | + return 0; |
|
198 | + } |
|
176 | 199 | return ($a->groupResults[$this->id]["score"] > $b->groupResults[$this->id]["score"] ? -1 : 1); |
177 | 200 | }); |
178 | 201 | break;} |
@@ -185,20 +208,24 @@ discard block |
||
185 | 208 | if (gettype($value) === 'array') { |
186 | 209 | switch (strtolower($key)) { |
187 | 210 | case 'and': |
188 | - if ($this->filterAnd($team, $value)) return false; |
|
211 | + if ($this->filterAnd($team, $value)) { |
|
212 | + return false; |
|
213 | + } |
|
189 | 214 | break; |
190 | 215 | case 'or': |
191 | - if ($this->filterOr($team, $value)) return false; |
|
216 | + if ($this->filterOr($team, $value)) { |
|
217 | + return false; |
|
218 | + } |
|
192 | 219 | break; |
193 | 220 | default: |
194 | 221 | throw new \Exception('Unknown opperand type "'.$key.'". Expected "and" or "or".'); |
195 | 222 | break; |
196 | 223 | } |
197 | - } |
|
198 | - elseif ($value instanceof TeamFilter) { |
|
199 | - if (!$value->validate($team, $this->id, 'sum', $this)) return false; |
|
200 | - } |
|
201 | - else { |
|
224 | + } elseif ($value instanceof TeamFilter) { |
|
225 | + if (!$value->validate($team, $this->id, 'sum', $this)) { |
|
226 | + return false; |
|
227 | + } |
|
228 | + } else { |
|
202 | 229 | throw new \Exception('Filer ['.$key.'] is not an instance of TeamFilter class'); |
203 | 230 | } |
204 | 231 | } |
@@ -209,20 +236,24 @@ discard block |
||
209 | 236 | if (gettype($value) === 'array') { |
210 | 237 | switch (strtolower($key)) { |
211 | 238 | case 'and': |
212 | - if ($this->filterAnd($team, $value)) return true; |
|
239 | + if ($this->filterAnd($team, $value)) { |
|
240 | + return true; |
|
241 | + } |
|
213 | 242 | break; |
214 | 243 | case 'or': |
215 | - if ($this->filterOr($team, $value)) return true; |
|
244 | + if ($this->filterOr($team, $value)) { |
|
245 | + return true; |
|
246 | + } |
|
216 | 247 | break; |
217 | 248 | default: |
218 | 249 | throw new \Exception('Unknown opperand type "'.$key.'". Expected "and" or "or".'); |
219 | 250 | break; |
220 | 251 | } |
221 | - } |
|
222 | - elseif ($value instanceof TeamFilter) { |
|
223 | - if (!$value->validate($team, $this->id, 'sum', $this)) return true; |
|
224 | - } |
|
225 | - else { |
|
252 | + } elseif ($value instanceof TeamFilter) { |
|
253 | + if (!$value->validate($team, $this->id, 'sum', $this)) { |
|
254 | + return true; |
|
255 | + } |
|
256 | + } else { |
|
226 | 257 | throw new \Exception('Filer ['.$key.'] is not an instance of TeamFilter class'); |
227 | 258 | } |
228 | 259 | } |
@@ -238,8 +269,11 @@ discard block |
||
238 | 269 | } |
239 | 270 | |
240 | 271 | public function setOrdering(string $ordering = \POINTS) { |
241 | - if (in_array($ordering, orderingTypes)) $this->ordering = $ordering; |
|
242 | - else throw new \Exception('Unknown group ordering: '.$ordering); |
|
272 | + if (in_array($ordering, orderingTypes)) { |
|
273 | + $this->ordering = $ordering; |
|
274 | + } else { |
|
275 | + throw new \Exception('Unknown group ordering: '.$ordering); |
|
276 | + } |
|
243 | 277 | return $this; |
244 | 278 | } |
245 | 279 | public function getOrdering() { |
@@ -272,16 +306,13 @@ discard block |
||
272 | 306 | foreach ($teams as $team) { |
273 | 307 | if ($team instanceOf Team) { |
274 | 308 | $this->progressed[] = $team->id; |
275 | - } |
|
276 | - elseif (gettype($team) === 'string' || gettype($team) === 'integer') { |
|
309 | + } elseif (gettype($team) === 'string' || gettype($team) === 'integer') { |
|
277 | 310 | $this->progressed[] = $team; |
278 | - } |
|
279 | - elseif (gettype($team) === 'array') { |
|
311 | + } elseif (gettype($team) === 'array') { |
|
280 | 312 | foreach ($team as $teamInner) { |
281 | 313 | if ($teamInner instanceOf Team) { |
282 | 314 | $this->progressed[] = $teamInner->id; |
283 | - } |
|
284 | - elseif (gettype($teamInner) === 'string' || gettype($teamInner) === 'integer') { |
|
315 | + } elseif (gettype($teamInner) === 'string' || gettype($teamInner) === 'integer') { |
|
285 | 316 | $this->progressed[] = $teamInner; |
286 | 317 | } |
287 | 318 | } |
@@ -314,8 +345,11 @@ discard block |
||
314 | 345 | } |
315 | 346 | } |
316 | 347 | foreach ($games as $game) { |
317 | - if ($game instanceof Game) $this->games[] = $game; |
|
318 | - else throw new \Exception('Trying to add game which is not instance of Game object.'); |
|
348 | + if ($game instanceof Game) { |
|
349 | + $this->games[] = $game; |
|
350 | + } else { |
|
351 | + throw new \Exception('Trying to add game which is not instance of Game object.'); |
|
352 | + } |
|
319 | 353 | } |
320 | 354 | return $this; |
321 | 355 | } |
@@ -323,7 +357,9 @@ discard block |
||
323 | 357 | return $this->games; |
324 | 358 | } |
325 | 359 | public function orderGames() { |
326 | - if (count($this->games) <= 4) return $this->games; |
|
360 | + if (count($this->games) <= 4) { |
|
361 | + return $this->games; |
|
362 | + } |
|
327 | 363 | $this->games = $this->generator->orderGames(); |
328 | 364 | return $this->games; |
329 | 365 | } |
@@ -338,7 +374,9 @@ discard block |
||
338 | 374 | $game->setResults($results); |
339 | 375 | } |
340 | 376 | $return = $this->sortTeams($filters); |
341 | - if (!$reset) return $return; |
|
377 | + if (!$reset) { |
|
378 | + return $return; |
|
379 | + } |
|
342 | 380 | foreach ($this->getGames() as $game) { |
343 | 381 | $game->resetResults(); |
344 | 382 | } |
@@ -346,13 +384,17 @@ discard block |
||
346 | 384 | } |
347 | 385 | public function resetGames() { |
348 | 386 | foreach ($this->getGames() as $game) { |
349 | - if (isset($game)) $game->resetResults(); |
|
387 | + if (isset($game)) { |
|
388 | + $game->resetResults(); |
|
389 | + } |
|
350 | 390 | } |
351 | 391 | return $this; |
352 | 392 | } |
353 | 393 | public function isPlayed(){ |
354 | 394 | foreach ($this->games as $game) { |
355 | - if ((isset($game) || !$this->getSkip()) && !$game->isPlayed()) return false; |
|
395 | + if ((isset($game) || !$this->getSkip()) && !$game->isPlayed()) { |
|
396 | + return false; |
|
397 | + } |
|
356 | 398 | } |
357 | 399 | return true; |
358 | 400 | } |
@@ -36,8 +36,11 @@ discard block |
||
36 | 36 | |
37 | 37 | |
38 | 38 | public function setType(/** @scrutinizer ignore-all */ string $type = \R_R) { |
39 | - if (in_array($type, \groupTypes)) $this->type = $type; |
|
40 | - else throw new \Exception('Unknown group type: '.$type); |
|
39 | + if (in_array($type, \groupTypes)) { |
|
40 | + $this->type = $type; |
|
41 | + } else { |
|
42 | + throw new \Exception('Unknown group type: '.$type); |
|
43 | + } |
|
41 | 44 | return $this; |
42 | 45 | } |
43 | 46 | public function getType() { |
@@ -45,7 +48,9 @@ discard block |
||
45 | 48 | } |
46 | 49 | |
47 | 50 | public function setInGame(int $inGame) { |
48 | - if ($inGame < 2 || $inGame > 4) throw new \Exception('Expected 2,3 or 4 as inGame '.$inGame.' given'); |
|
51 | + if ($inGame < 2 || $inGame > 4) { |
|
52 | + throw new \Exception('Expected 2,3 or 4 as inGame '.$inGame.' given'); |
|
53 | + } |
|
49 | 54 | $this->inGame = $inGame; |
50 | 55 | return $this; |
51 | 56 | } |
@@ -54,7 +59,9 @@ discard block |
||
54 | 59 | } |
55 | 60 | |
56 | 61 | public function setMaxSize(int $maxSize) { |
57 | - if ($maxSize < 2) throw new \Exception('Max group size has to be at least 2, '.$maxSize.' given'); |
|
62 | + if ($maxSize < 2) { |
|
63 | + throw new \Exception('Max group size has to be at least 2, '.$maxSize.' given'); |
|
64 | + } |
|
58 | 65 | $this->maxSize = $maxSize; |
59 | 66 | return $this; |
60 | 67 | } |
@@ -80,7 +87,9 @@ discard block |
||
80 | 87 | $this->group->game($tInGame); |
81 | 88 | } |
82 | 89 | |
83 | - if (count($discard) > 0 && !$this->allowSkip) throw new \Exception('Couldn\'t make games with all teams. Expected k*'.$this->inGame.' teams '.$count.' teams given - discarting '.count($discard).' teams ('.implode(', ', $discard).') in group '.$this->group.' - allow skip '.($this->allowSkip ? 'True' : 'False')); |
|
90 | + if (count($discard) > 0 && !$this->allowSkip) { |
|
91 | + throw new \Exception('Couldn\'t make games with all teams. Expected k*'.$this->inGame.' teams '.$count.' teams given - discarting '.count($discard).' teams ('.implode(', ', $discard).') in group '.$this->group.' - allow skip '.($this->allowSkip ? 'True' : 'False')); |
|
92 | + } |
|
84 | 93 | break; |
85 | 94 | case \COND_SPLIT: |
86 | 95 | $games = []; |
@@ -95,19 +104,24 @@ discard block |
||
95 | 104 | while ($g > 0) { |
96 | 105 | foreach ($games as $key => $group) { |
97 | 106 | $this->group->addGame(array_shift($games[$key])); |
98 | - if (count($games[$key]) === 0) unset($games[$key]); |
|
107 | + if (count($games[$key]) === 0) { |
|
108 | + unset($games[$key]); |
|
109 | + } |
|
99 | 110 | $g--; |
100 | 111 | } |
101 | 112 | } |
113 | + } else { |
|
114 | + $this->group->addGame($this->r_rGames()); |
|
102 | 115 | } |
103 | - else $this->group->addGame($this->r_rGames()); |
|
104 | 116 | break; |
105 | 117 | } |
106 | 118 | return $this->group->getGames(); |
107 | 119 | } |
108 | 120 | public function r_rGames(array $teams = []) { |
109 | 121 | $games = []; |
110 | - if (count($teams) === 0) $teams = $this->group->getTeams(); |
|
122 | + if (count($teams) === 0) { |
|
123 | + $teams = $this->group->getTeams(); |
|
124 | + } |
|
111 | 125 | switch ($this->inGame) { |
112 | 126 | case 2: |
113 | 127 | $games = Generator::circle_genGames2($teams, $this->group); |
@@ -154,7 +168,10 @@ discard block |
||
154 | 168 | public static function circle_genGames2(array $teams = [], \tournamentGenerator\Group $group) { |
155 | 169 | $bracket = []; // ARRAY OF GAMES |
156 | 170 | |
157 | - if (count($teams) % 2 != 0) $teams[] = \DUMMY_TEAM; // IF NOT EVEN NUMBER OF TEAMS, ADD DUMMY |
|
171 | + if (count($teams) % 2 != 0) { |
|
172 | + $teams[] = \DUMMY_TEAM; |
|
173 | + } |
|
174 | + // IF NOT EVEN NUMBER OF TEAMS, ADD DUMMY |
|
158 | 175 | |
159 | 176 | shuffle($teams); // SHUFFLE TEAMS FOR MORE RANDOMNESS |
160 | 177 | |
@@ -178,7 +195,10 @@ discard block |
||
178 | 195 | $reverse = array_reverse($teams); |
179 | 196 | $away = $reverse[$i]; |
180 | 197 | |
181 | - if (($home == \DUMMY_TEAM || $away == \DUMMY_TEAM)) continue; // SKIP WHEN DUMMY_TEAM IS PRESENT |
|
198 | + if (($home == \DUMMY_TEAM || $away == \DUMMY_TEAM)) { |
|
199 | + continue; |
|
200 | + } |
|
201 | + // SKIP WHEN DUMMY_TEAM IS PRESENT |
|
182 | 202 | |
183 | 203 | $bracket[] = new \TournamentGenerator\Game([$home, $away], $group); |
184 | 204 |
@@ -25,8 +25,11 @@ discard block |
||
25 | 25 | |
26 | 26 | public function addGroup(Group ...$groups){ |
27 | 27 | foreach ($groups as $group) { |
28 | - if ($group instanceof Group) $this->groups[] = $group; |
|
29 | - else throw new \Exception('Trying to add group which is not an instance of Group class.'); |
|
28 | + if ($group instanceof Group) { |
|
29 | + $this->groups[] = $group; |
|
30 | + } else { |
|
31 | + throw new \Exception('Trying to add group which is not an instance of Group class.'); |
|
32 | + } |
|
30 | 33 | } |
31 | 34 | return $this; |
32 | 35 | } |
@@ -77,7 +80,9 @@ discard block |
||
77 | 80 | } |
78 | 81 | public function isPlayed(){ |
79 | 82 | foreach ($this->groups as $group) { |
80 | - if (!$group->isPlayed()) return false; |
|
83 | + if (!$group->isPlayed()) { |
|
84 | + return false; |
|
85 | + } |
|
81 | 86 | } |
82 | 87 | return true; |
83 | 88 | } |
@@ -86,10 +91,11 @@ discard block |
||
86 | 91 | foreach ($teams as $team) { |
87 | 92 | if ($team instanceof Team) { |
88 | 93 | $this->teams[] = $team; |
89 | - } |
|
90 | - elseif (gettype($team) === 'array') { |
|
94 | + } elseif (gettype($team) === 'array') { |
|
91 | 95 | foreach ($team as $team2) { |
92 | - if ($team2 instanceof Team) $this->teams[] = $team2; |
|
96 | + if ($team2 instanceof Team) { |
|
97 | + $this->teams[] = $team2; |
|
98 | + } |
|
93 | 99 | $team2->groupResults[$this->id] = [ |
94 | 100 | 'group' => $this, |
95 | 101 | 'points' => 0, |
@@ -101,8 +107,9 @@ discard block |
||
101 | 107 | 'third' => 0 |
102 | 108 | ]; |
103 | 109 | } |
110 | + } else { |
|
111 | + throw new \Exception('Trying to add team which is not an instance of Team class'); |
|
104 | 112 | } |
105 | - else throw new \Exception('Trying to add team which is not an instance of Team class'); |
|
106 | 113 | } |
107 | 114 | return $this; |
108 | 115 | } |
@@ -129,14 +136,20 @@ discard block |
||
129 | 136 | switch ($ordering) { |
130 | 137 | case \POINTS:{ |
131 | 138 | uasort($this->teams, function($a, $b) use ($groupsIds) { |
132 | - if ($a->sumPoints($groupsIds) === $b->sumPoints($groupsIds) && $a->sumScore($groupsIds) === $b->sumScore($groupsIds)) return 0; |
|
133 | - if ($a->sumPoints($groupsIds) === $b->sumPoints($groupsIds)) return ($a->sumScore($groupsIds) > $b->sumScore($groupsIds) ? -1 : 1); |
|
139 | + if ($a->sumPoints($groupsIds) === $b->sumPoints($groupsIds) && $a->sumScore($groupsIds) === $b->sumScore($groupsIds)) { |
|
140 | + return 0; |
|
141 | + } |
|
142 | + if ($a->sumPoints($groupsIds) === $b->sumPoints($groupsIds)) { |
|
143 | + return ($a->sumScore($groupsIds) > $b->sumScore($groupsIds) ? -1 : 1); |
|
144 | + } |
|
134 | 145 | return ($a->sumPoints($groupsIds) > $b->sumPoints($groupsIds) ? -1 : 1); |
135 | 146 | }); |
136 | 147 | break;} |
137 | 148 | case \SCORE:{ |
138 | 149 | uasort($this->teams, function($a, $b) use ($groupsIds) { |
139 | - if ($a->sumScore($groupsIds) === $b->sumScore($groupsIds)) return 0; |
|
150 | + if ($a->sumScore($groupsIds) === $b->sumScore($groupsIds)) { |
|
151 | + return 0; |
|
152 | + } |
|
140 | 153 | return ($a->sumScore($groupsIds) > $b->sumScore($groupsIds) ? -1 : 1); |
141 | 154 | }); |
142 | 155 | break;} |
@@ -146,7 +159,9 @@ discard block |
||
146 | 159 | |
147 | 160 | public function splitTeams(...$groups) { |
148 | 161 | |
149 | - if (count($groups) === 0) $groups = $this->getGroups(); |
|
162 | + if (count($groups) === 0) { |
|
163 | + $groups = $this->getGroups(); |
|
164 | + } |
|
150 | 165 | |
151 | 166 | foreach ($groups as $key => $value) { |
152 | 167 | if (gettype($value) === 'array') { |
@@ -161,7 +176,9 @@ discard block |
||
161 | 176 | while (count($teams) > 0) { |
162 | 177 | foreach ($groups as $group) { |
163 | 178 | if ($group instanceof Group) { |
164 | - if (count($teams) > 0) $group->addTeam(array_shift($teams)); |
|
179 | + if (count($teams) > 0) { |
|
180 | + $group->addTeam(array_shift($teams)); |
|
181 | + } |
|
165 | 182 | } |
166 | 183 | } |
167 | 184 | } |
@@ -177,7 +194,9 @@ discard block |
||
177 | 194 | |
178 | 195 | public function simulate() { |
179 | 196 | foreach ($this->groups as $group) { |
180 | - if ($group->isPlayed()) continue; |
|
197 | + if ($group->isPlayed()) { |
|
198 | + continue; |
|
199 | + } |
|
181 | 200 | $group->simulate([], false); |
182 | 201 | } |
183 | 202 | return $this; |