@@ -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 | } |
@@ -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; |
@@ -91,8 +91,7 @@ discard block |
||
91 | 91 | } |
92 | 92 | if ($ordered) { |
93 | 93 | $returnTeams = $this->sortTeams($ordering); |
94 | - } |
|
95 | - else { |
|
94 | + } else { |
|
96 | 95 | $returnTeams = $this->teams->unique()->get(); |
97 | 96 | } |
98 | 97 | |
@@ -142,8 +141,7 @@ discard block |
||
142 | 141 | if ($this instanceof WithGroupsInterface) { |
143 | 142 | $filter = new Filter($filters, $this->getGroups()); |
144 | 143 | $filter->filter($teams); |
145 | - } |
|
146 | - else if ($this instanceof Group) { |
|
144 | + } else if ($this instanceof Group) { |
|
147 | 145 | $filter = new Filter($filters, [$this]); |
148 | 146 | $filter->filter($teams); |
149 | 147 | } |
@@ -48,8 +48,7 @@ discard block |
||
48 | 48 | // Get initial data |
49 | 49 | if ($this->topLevelOnly) { |
50 | 50 | $data = $this->container->getTopLevel(); |
51 | - } |
|
52 | - else { |
|
51 | + } else { |
|
53 | 52 | $data = $this->container->get(); |
54 | 53 | } |
55 | 54 | |
@@ -64,8 +63,7 @@ discard block |
||
64 | 63 | } |
65 | 64 | $ids[] = $obj->getId(); |
66 | 65 | } |
67 | - } |
|
68 | - else { |
|
66 | + } else { |
|
69 | 67 | $data = array_unique($data); |
70 | 68 | } |
71 | 69 | } |
@@ -78,11 +76,9 @@ discard block |
||
78 | 76 | // Sorting |
79 | 77 | if (isset($this->sorter)) { |
80 | 78 | $data = $this->sorter->sort($data); |
81 | - } |
|
82 | - elseif (isset($this->sortClosure)) { |
|
79 | + } elseif (isset($this->sortClosure)) { |
|
83 | 80 | uasort($data, $this->sortClosure); |
84 | - } |
|
85 | - elseif (isset($this->sortProperty)) { |
|
81 | + } elseif (isset($this->sortProperty)) { |
|
86 | 82 | uasort($data, [$this, 'sortByPropertyCallback']); |
87 | 83 | } |
88 | 84 | |
@@ -181,14 +177,12 @@ discard block |
||
181 | 177 | $property2 = null; |
182 | 178 | if (is_object($value1) && isset($value1->$property)) { |
183 | 179 | $property1 = $value1->$property; |
184 | - } |
|
185 | - elseif (is_array($value1) && isset($value1[$property])) { |
|
180 | + } elseif (is_array($value1) && isset($value1[$property])) { |
|
186 | 181 | $property1 = $value1[$property]; |
187 | 182 | } |
188 | 183 | if (is_object($value2) && isset($value2->$property)) { |
189 | 184 | $property2 = $value2->$property; |
190 | - } |
|
191 | - elseif (is_array($value2) && isset($value2[$property])) { |
|
185 | + } elseif (is_array($value2) && isset($value2[$property])) { |
|
192 | 186 | $property2 = $value2[$property]; |
193 | 187 | } |
194 | 188 |