@@ -93,9 +93,13 @@ discard block |
||
93 | 93 | return $this->games; |
94 | 94 | } |
95 | 95 | public function isPlayed(){ |
96 | - if (count($this->games) === 0) return false; |
|
96 | + if (count($this->games) === 0) { |
|
97 | + return false; |
|
98 | + } |
|
97 | 99 | foreach ($this->groups as $group) { |
98 | - if (!$group->isPlayed()) return false; |
|
100 | + if (!$group->isPlayed()) { |
|
101 | + return false; |
|
102 | + } |
|
99 | 103 | } |
100 | 104 | return true; |
101 | 105 | } |
@@ -131,14 +135,18 @@ discard block |
||
131 | 135 | |
132 | 136 | public function splitTeams(Group ...$groups) { |
133 | 137 | |
134 | - if (count($groups) === 0) $groups = $this->getGroups(); |
|
138 | + if (count($groups) === 0) { |
|
139 | + $groups = $this->getGroups(); |
|
140 | + } |
|
135 | 141 | |
136 | 142 | $teams = $this->getTeams(); |
137 | 143 | shuffle($teams); |
138 | 144 | |
139 | 145 | while (count($teams) > 0) { |
140 | 146 | foreach ($groups as $group) { |
141 | - if (count($teams) > 0) $group->addTeam(array_shift($teams)); |
|
147 | + if (count($teams) > 0) { |
|
148 | + $group->addTeam(array_shift($teams)); |
|
149 | + } |
|
142 | 150 | } |
143 | 151 | } |
144 | 152 | return $this; |
@@ -141,7 +141,9 @@ discard block |
||
141 | 141 | $teams = array_merge($teams, $round->getTeams()); |
142 | 142 | } |
143 | 143 | $this->teams = \array_unique($teams); |
144 | - if ($ordered) $this->sortTeams($ordering); |
|
144 | + if ($ordered) { |
|
145 | + $this->sortTeams($ordering); |
|
146 | + } |
|
145 | 147 | return $this->teams; |
146 | 148 | } |
147 | 149 | public function sortTeams($ordering = \TournamentGenerator\Constants::POINTS) { |
@@ -164,14 +166,18 @@ discard block |
||
164 | 166 | |
165 | 167 | public function splitTeams(Round ...$wheres) { |
166 | 168 | |
167 | - if (count($wheres) === 0) $wheres = $this->getRounds(); |
|
169 | + if (count($wheres) === 0) { |
|
170 | + $wheres = $this->getRounds(); |
|
171 | + } |
|
168 | 172 | |
169 | 173 | $teams = $this->getTeams(); |
170 | 174 | shuffle($teams); |
171 | 175 | |
172 | 176 | while (count($teams) > 0) { |
173 | 177 | foreach ($wheres as $where) { |
174 | - if (count($teams) > 0) $where->addTeam(array_shift($teams)); |
|
178 | + if (count($teams) > 0) { |
|
179 | + $where->addTeam(array_shift($teams)); |
|
180 | + } |
|
175 | 181 | } |
176 | 182 | } |
177 | 183 | foreach ($wheres as $where) { |
@@ -183,13 +189,17 @@ discard block |
||
183 | 189 | public function genGamesSimulate(bool $returnTime = false) { |
184 | 190 | $games = Utilis\Simulator::simulateTournament($this); |
185 | 191 | |
186 | - if ($returnTime) return $this->getTournamentTime(); |
|
192 | + if ($returnTime) { |
|
193 | + return $this->getTournamentTime(); |
|
194 | + } |
|
187 | 195 | return $games; |
188 | 196 | } |
189 | 197 | public function genGamesSimulateReal(bool $returnTime = false) { |
190 | 198 | $games = Utilis\Simulator::simulateTournamentReal($this); |
191 | 199 | |
192 | - if ($returnTime) return $this->getTournamentTime(); |
|
200 | + if ($returnTime) { |
|
201 | + return $this->getTournamentTime(); |
|
202 | + } |
|
193 | 203 | return $games; |
194 | 204 | } |
195 | 205 |
@@ -100,7 +100,9 @@ discard block |
||
100 | 100 | return $t; |
101 | 101 | } |
102 | 102 | public function sortTeams(array $filters = [], $ordering = null) { |
103 | - if (!isset($ordering)) $ordering = $this->ordering; |
|
103 | + if (!isset($ordering)) { |
|
104 | + $ordering = $this->ordering; |
|
105 | + } |
|
104 | 106 | Utilis\Sorter\Teams::sortGroup($this->teams, $this, $ordering); |
105 | 107 | return $this->getTeams($filters); |
106 | 108 | } |
@@ -130,7 +132,9 @@ discard block |
||
130 | 132 | } |
131 | 133 | |
132 | 134 | public function setOrdering(string $ordering = \TournamentGenerator\Constants::POINTS) { |
133 | - if (!in_array($ordering, \TournamentGenerator\Constants::OrderingTypes)) throw new \Exception('Unknown group ordering: '.$ordering); |
|
135 | + if (!in_array($ordering, \TournamentGenerator\Constants::OrderingTypes)) { |
|
136 | + throw new \Exception('Unknown group ordering: '.$ordering); |
|
137 | + } |
|
134 | 138 | $this->ordering = $ordering; |
135 | 139 | return $this; |
136 | 140 | } |
@@ -195,7 +199,9 @@ discard block |
||
195 | 199 | return $this->games; |
196 | 200 | } |
197 | 201 | public function orderGames() { |
198 | - if (count($this->games) <= 4) return $this->games; |
|
202 | + if (count($this->games) <= 4) { |
|
203 | + return $this->games; |
|
204 | + } |
|
199 | 205 | $this->games = $this->generator->orderGames(); |
200 | 206 | return $this->games; |
201 | 207 | } |
@@ -210,9 +216,13 @@ discard block |
||
210 | 216 | return $this; |
211 | 217 | } |
212 | 218 | public function isPlayed(){ |
213 | - if (count($this->games) === 0) return false; |
|
219 | + if (count($this->games) === 0) { |
|
220 | + return false; |
|
221 | + } |
|
214 | 222 | foreach ($this->games as $game) { |
215 | - if (!$game->isPlayed()) return false; |
|
223 | + if (!$game->isPlayed()) { |
|
224 | + return false; |
|
225 | + } |
|
216 | 226 | } |
217 | 227 | return true; |
218 | 228 | } |