@@ -62,8 +62,7 @@ |
||
62 | 62 | public function setType(string $type = Constants::ROUND_ROBIN) : Generator { |
63 | 63 | if (in_array($type, Constants::GroupTypes, true)) { |
64 | 64 | $this->type = $type; |
65 | - } |
|
66 | - else { |
|
65 | + } else { |
|
67 | 66 | throw new Exception('Unknown group type: '.$type); |
68 | 67 | } |
69 | 68 | return $this; |
@@ -221,13 +221,11 @@ |
||
221 | 221 | $this->drawIds[] = $team->getId(); |
222 | 222 | $team->addDraw($this->group->getId()); |
223 | 223 | $this->results[$team->getId()] += ['points' => $this->group->getDrawPoints(), 'type' => 'draw']; |
224 | - } |
|
225 | - elseif ($teamPosition === 1) { |
|
224 | + } elseif ($teamPosition === 1) { |
|
226 | 225 | $this->winId = $team->getId(); |
227 | 226 | $team->addWin($this->group->getId()); |
228 | 227 | $this->results[$team->getId()] += ['points' => $this->group->getWinPoints(), 'type' => 'win']; |
229 | - } |
|
230 | - else { |
|
228 | + } else { |
|
231 | 229 | $this->lossId = $team->getId(); |
232 | 230 | $team->addLoss($this->group->getId()); |
233 | 231 | $this->results[$team->getId()] += ['points' => $this->group->getLostPoints(), 'type' => 'loss']; |
@@ -145,8 +145,7 @@ discard block |
||
145 | 145 | if ($roundNum === 2) { // FIRST LOSING ROUND |
146 | 146 | $previousGroups[2 * ($g - 1)]->progression($group, 1, 1); // PROGRESS FROM STARTING GROUP |
147 | 147 | $previousGroups[(2 * ($g - 1)) + 1]->progression($group, 1, 1); // PROGRESS FROM STARTING GROUP |
148 | - } |
|
149 | - elseif ($losingGroupTeamsCount >= 2) { |
|
148 | + } elseif ($losingGroupTeamsCount >= 2) { |
|
150 | 149 | $previousLosingGroups[$g - 1]->progression($group, 0, 1); // PROGRESS FROM LOSING GROUP BEFORE |
151 | 150 | if (isset(array_reverse($previousGroups)[$g - 1])) { |
152 | 151 | array_reverse($previousGroups)[$g - 1]->progression($group, 1, 1); |
@@ -156,8 +155,7 @@ discard block |
||
156 | 155 | } // PROGRESS OTHER TEAM FROM LOSING GROUP BEFORE |
157 | 156 | } |
158 | 157 | } |
159 | - } |
|
160 | - else { // IF THE NUMBER OF TEAMS IS NOT A POWER OF 2, GENERATE GROUPS WITH BYES |
|
158 | + } else { // IF THE NUMBER OF TEAMS IS NOT A POWER OF 2, GENERATE GROUPS WITH BYES |
|
161 | 159 | // LOOK FOR THE CLOSEST LOWER POWER OF 2 |
162 | 160 | $losingByes = $losingGroupTeamsCount - Functions::previousPowerOf2($losingGroupTeamsCount); |
163 | 161 | $n = (floor(count($previousLosingGroups) / 2) + $losingByes); |
@@ -179,8 +177,7 @@ discard block |
||
179 | 177 | if (isset($previousGroups[$byesProgressed]) && in_array($lastGroup, $byesGroupsNums, true)) { // EMPTY GROUP FROM BYE |
180 | 178 | $previousGroups[$byesProgressed]->progression($group, 1, 1); // PROGRESS FROM WINNING GROUP BEFORE |
181 | 179 | $byesProgressed++; |
182 | - } |
|
183 | - else { |
|
180 | + } else { |
|
184 | 181 | $previousLosingGroups[$lastGroup]->progression($group, 0, 1); // PROGRESS FROM LOSING GROUP BEFORE |
185 | 182 | if (isset($previousLosingGroups[$lastGroup + 1])) { // PROGRESS FROM LOSING GROUP BEFORE |
186 | 183 | $previousLosingGroups[$lastGroup + 1]->progression($group, 0, 1); |
@@ -95,15 +95,13 @@ discard block |
||
95 | 95 | |
96 | 96 | if ($blank) { |
97 | 97 | $teams = $this->from->isPlayed() ? $this->from->sortTeams(null, $this->filters) : $this->from->simulate($this->filters); |
98 | - } |
|
99 | - else { |
|
98 | + } else { |
|
100 | 99 | $teams = $this->from->sortTeams(null, $this->filters); |
101 | 100 | } |
102 | 101 | |
103 | 102 | if ($this->start !== 0 || $this->len !== null) { |
104 | 103 | $next = array_splice($teams, $this->start, ($this->len ?? count($teams))); |
105 | - } |
|
106 | - else { |
|
104 | + } else { |
|
107 | 105 | $next = $teams; |
108 | 106 | } |
109 | 107 | |
@@ -112,8 +110,7 @@ discard block |
||
112 | 110 | foreach ($next as $team) { |
113 | 111 | if ($blank) { |
114 | 112 | $this->to->addTeam(new BlankTeam($this.' - '.$i++, $team, $this->from, $this)); |
115 | - } |
|
116 | - else { |
|
113 | + } else { |
|
117 | 114 | $team->addPoints($this->from->getProgressPoints()); |
118 | 115 | } |
119 | 116 | } |
@@ -112,8 +112,7 @@ discard block |
||
112 | 112 | $data['categories'] = [ |
113 | 113 | $this->object->getId() => $this->getCategoryData($this->object), |
114 | 114 | ]; |
115 | - } |
|
116 | - elseif ($this->object instanceof WithCategories) { |
|
115 | + } elseif ($this->object instanceof WithCategories) { |
|
117 | 116 | $data['categories'] = []; |
118 | 117 | foreach ($this->object->getCategories() as $category) { |
119 | 118 | $data['categories'][$category->getId()] = $this->getCategoryData($category); |
@@ -153,8 +152,7 @@ discard block |
||
153 | 152 | $data['rounds'] = [ |
154 | 153 | $this->object->getId() => $this->getRoundData($this->object), |
155 | 154 | ]; |
156 | - } |
|
157 | - elseif ($this->object instanceof WithRounds) { |
|
155 | + } elseif ($this->object instanceof WithRounds) { |
|
158 | 156 | $data['rounds'] = []; |
159 | 157 | foreach ($this->object->getRounds() as $round) { |
160 | 158 | $data['rounds'][$round->getId()] = $this->getRoundData($round); |
@@ -197,8 +195,7 @@ discard block |
||
197 | 195 | foreach ($this->object->getProgressions() as $progression) { |
198 | 196 | $data['progressions'][] = $this->getProgressionData($progression); |
199 | 197 | } |
200 | - } |
|
201 | - elseif ($this->object instanceof WithGroups) { |
|
198 | + } elseif ($this->object instanceof WithGroups) { |
|
202 | 199 | foreach ($this->object->getGroups() as $group) { |
203 | 200 | $data['groups'][$group->getId()] = $this->getGroupData($group); |
204 | 201 | foreach ($group->getProgressions() as $progression) { |
@@ -490,8 +490,7 @@ |
||
490 | 490 | foreach (((array) $data) as $key => $value) { |
491 | 491 | self::validateParams($value, array_merge($keys, [$key]), $setting['parameters'][$key]); |
492 | 492 | } |
493 | - } |
|
494 | - else { |
|
493 | + } else { |
|
495 | 494 | foreach (((array) $data) as $object) { |
496 | 495 | foreach (((array) $object) as $key => $value) { |
497 | 496 | self::validateParams($value, array_merge($keys, [$key]), $setting['parameters'][$key]); |
@@ -118,8 +118,7 @@ |
||
118 | 118 | // Check tournament type (can be a preset) |
119 | 119 | if (empty($setting['type']) || $setting['type'] === 'general') { |
120 | 120 | $tournament = new Tournament(); |
121 | - } |
|
122 | - else { |
|
121 | + } else { |
|
123 | 122 | $tournament = new $setting['type']; |
124 | 123 | } |
125 | 124 | self::$root = $tournament; // If set - Tournament is always root |
@@ -92,8 +92,7 @@ |
||
92 | 92 | foreach ($this->exporters as $name => $exporter) { |
93 | 93 | if ($name === 'setup') { |
94 | 94 | $data += $exporter->get(); |
95 | - } |
|
96 | - else { |
|
95 | + } else { |
|
97 | 96 | $data[$name] = $exporter->get(); |
98 | 97 | } |
99 | 98 | } |
@@ -61,8 +61,7 @@ discard block |
||
61 | 61 | $teams = $this->getTeams(true, Constants::SEED); |
62 | 62 | if ($this::isSeeded($teams)) { |
63 | 63 | Functions::sortAlternate($teams); |
64 | - } |
|
65 | - else { |
|
64 | + } else { |
|
66 | 65 | shuffle($teams); |
67 | 66 | } |
68 | 67 | |
@@ -94,8 +93,7 @@ discard block |
||
94 | 93 | } |
95 | 94 | if ($ordered) { |
96 | 95 | $returnTeams = $this->sortTeams($ordering); |
97 | - } |
|
98 | - else { |
|
96 | + } else { |
|
99 | 97 | $returnTeams = $this->teams->unique()->get(); |
100 | 98 | } |
101 | 99 | |
@@ -145,8 +143,7 @@ discard block |
||
145 | 143 | if ($this instanceof WithGroupsInterface) { |
146 | 144 | $filter = new Filter($filters, $this->getGroups()); |
147 | 145 | $filter->filter($teams); |
148 | - } |
|
149 | - else if ($this instanceof Group) { |
|
146 | + } else if ($this instanceof Group) { |
|
150 | 147 | $filter = new Filter($filters, [$this]); |
151 | 148 | $filter->filter($teams); |
152 | 149 | } |