@@ -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']; |
@@ -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 | } |
@@ -64,8 +64,7 @@ discard block |
||
64 | 64 | // Get initial data |
65 | 65 | if ($this->topLevelOnly) { |
66 | 66 | $data = $this->container->getTopLevel(); |
67 | - } |
|
68 | - else { |
|
67 | + } else { |
|
69 | 68 | $data = $this->container->get(); |
70 | 69 | } |
71 | 70 | |
@@ -105,8 +104,7 @@ discard block |
||
105 | 104 | } |
106 | 105 | $ids[] = $obj->getId(); |
107 | 106 | } |
108 | - } |
|
109 | - else { |
|
107 | + } else { |
|
110 | 108 | $data = array_unique($data); |
111 | 109 | } |
112 | 110 | } |
@@ -132,11 +130,9 @@ discard block |
||
132 | 130 | protected function sortData(array &$data) : void { |
133 | 131 | if (isset($this->sorter)) { |
134 | 132 | $data = $this->sorter->sort($data); |
135 | - } |
|
136 | - elseif (isset($this->sortClosure)) { |
|
133 | + } elseif (isset($this->sortClosure)) { |
|
137 | 134 | uasort($data, $this->sortClosure); |
138 | - } |
|
139 | - elseif (isset($this->sortProperty)) { |
|
135 | + } elseif (isset($this->sortProperty)) { |
|
140 | 136 | uasort($data, [$this, 'sortByPropertyCallback']); |
141 | 137 | } |
142 | 138 | } |
@@ -226,8 +222,7 @@ discard block |
||
226 | 222 | } |
227 | 223 | return $a < $b ? -1 : 1; |
228 | 224 | }; |
229 | - } |
|
230 | - else { |
|
225 | + } else { |
|
231 | 226 | $this->sortClosure = $callback; |
232 | 227 | } |
233 | 228 | return $this; |
@@ -309,14 +304,12 @@ discard block |
||
309 | 304 | $property2 = null; |
310 | 305 | if (is_object($value1) && isset($value1->$property)) { |
311 | 306 | $property1 = $value1->$property; |
312 | - } |
|
313 | - elseif (is_array($value1) && isset($value1[$property])) { |
|
307 | + } elseif (is_array($value1) && isset($value1[$property])) { |
|
314 | 308 | $property1 = $value1[$property]; |
315 | 309 | } |
316 | 310 | if (is_object($value2) && isset($value2->$property)) { |
317 | 311 | $property2 = $value2->$property; |
318 | - } |
|
319 | - elseif (is_array($value2) && isset($value2[$property])) { |
|
312 | + } elseif (is_array($value2) && isset($value2[$property])) { |
|
320 | 313 | $property2 = $value2[$property]; |
321 | 314 | } |
322 | 315 |
@@ -78,8 +78,7 @@ |
||
78 | 78 | if ($i % 2 === 0) { |
79 | 79 | $new[] = array_shift($array); |
80 | 80 | $new[] = array_pop($array); |
81 | - } |
|
82 | - else { |
|
81 | + } else { |
|
83 | 82 | $new2[] = array_shift($array); |
84 | 83 | $new2[] = array_pop($array); |
85 | 84 | } |