@@ -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); |
@@ -97,8 +97,7 @@ discard block |
||
| 97 | 97 | foreach ($this->getRounds() as $round) { |
| 98 | 98 | $teams[] = $round->getTeams(); |
| 99 | 99 | } |
| 100 | - } |
|
| 101 | - elseif ($this instanceof WithGroups) { |
|
| 100 | + } elseif ($this instanceof WithGroups) { |
|
| 102 | 101 | foreach ($this->getGroups() as $group) { |
| 103 | 102 | $teams[] = $group->getTeams(); |
| 104 | 103 | } |
@@ -158,8 +157,7 @@ discard block |
||
| 158 | 157 | } |
| 159 | 158 | $this->teams = array_values($teams); |
| 160 | 159 | } |
| 161 | - } |
|
| 162 | - elseif ($this instanceof WithGroups) { |
|
| 160 | + } elseif ($this instanceof WithGroups) { |
|
| 163 | 161 | foreach ($this->getGroups() as $group) { |
| 164 | 162 | $teams[] = $group->getTeams(true); |
| 165 | 163 | } |
@@ -168,11 +166,9 @@ discard block |
||
| 168 | 166 | |
| 169 | 167 | if ($this instanceof Round) { |
| 170 | 168 | $teams = Teams::sortRound($this->teams, $this, $ordering); |
| 171 | - } |
|
| 172 | - elseif ($this instanceof Group) { |
|
| 169 | + } elseif ($this instanceof Group) { |
|
| 173 | 170 | $teams = Teams::sortGroup($this->teams, $this, $ordering); |
| 174 | - } |
|
| 175 | - else { |
|
| 171 | + } else { |
|
| 176 | 172 | $teams = $this->teams; |
| 177 | 173 | } |
| 178 | 174 | $this->teams = $teams; |
@@ -199,8 +195,7 @@ discard block |
||
| 199 | 195 | if ($this instanceof WithGroups) { |
| 200 | 196 | $filter = new Filter($filters, $this->getGroups()); |
| 201 | 197 | $filter->filter($teams); |
| 202 | - } |
|
| 203 | - else if ($this instanceof Group) { |
|
| 198 | + } else if ($this instanceof Group) { |
|
| 204 | 199 | $filter = new Filter($filters, [$this]); |
| 205 | 200 | $filter->filter($teams); |
| 206 | 201 | } |
@@ -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 | } |
@@ -70,8 +70,7 @@ |
||
| 70 | 70 | if (!is_string($id) && !is_int($id)) { |
| 71 | 71 | $this->id = uniqid('', false); |
| 72 | 72 | throw new InvalidArgumentException('Unsupported id type ('.gettype($id).') - expected type of string or int'); |
| 73 | - } |
|
| 74 | - else { |
|
| 73 | + } else { |
|
| 75 | 74 | $this->id = $id; |
| 76 | 75 | } |
| 77 | 76 | return $this; |