Passed
Push — master ( c5a571...411ad7 )
by Tomáš
03:30
created
src/TournamentGenerator/Helpers/Generator.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,8 +62,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/TournamentGenerator/Game.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -221,13 +221,11 @@
 block discarded – undo
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'];
Please login to merge, or discard this patch.
src/TournamentGenerator/Preset/DoubleElimination.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -145,8 +145,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/TournamentGenerator/Progression.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -95,15 +95,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
src/TournamentGenerator/Base.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,8 +70,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/TournamentGenerator/Traits/WithTeams.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -91,8 +91,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
src/TournamentGenerator/Containers/ContainerQuery.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -64,8 +64,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
105 104
 					}
106 105
 					$ids[] = $obj->getId();
107 106
 				}
108
-			}
109
-			else {
107
+			} else {
110 108
 				$data = array_unique($data);
111 109
 			}
112 110
 		}
@@ -131,11 +129,9 @@  discard block
 block discarded – undo
131 129
 	protected function sortData(array &$data) : void {
132 130
 		if (isset($this->sorter)) {
133 131
 			$data = $this->sorter->sort($data);
134
-		}
135
-		elseif (isset($this->sortClosure)) {
132
+		} elseif (isset($this->sortClosure)) {
136 133
 			uasort($data, $this->sortClosure);
137
-		}
138
-		elseif (isset($this->sortProperty)) {
134
+		} elseif (isset($this->sortProperty)) {
139 135
 			uasort($data, [$this, 'sortByPropertyCallback']);
140 136
 		}
141 137
 	}
@@ -274,14 +270,12 @@  discard block
 block discarded – undo
274 270
 		$property2 = null;
275 271
 		if (is_object($value1) && isset($value1->$property)) {
276 272
 			$property1 = $value1->$property;
277
-		}
278
-		elseif (is_array($value1) && isset($value1[$property])) {
273
+		} elseif (is_array($value1) && isset($value1[$property])) {
279 274
 			$property1 = $value1[$property];
280 275
 		}
281 276
 		if (is_object($value2) && isset($value2->$property)) {
282 277
 			$property2 = $value2->$property;
283
-		}
284
-		elseif (is_array($value2) && isset($value2[$property])) {
278
+		} elseif (is_array($value2) && isset($value2[$property])) {
285 279
 			$property2 = $value2[$property];
286 280
 		}
287 281
 
Please login to merge, or discard this patch.
src/TournamentGenerator/Export/Hierarchy/SetupExporter.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -112,8 +112,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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) {
Please login to merge, or discard this patch.
src/TournamentGenerator/Import/ImportValidator.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -490,8 +490,7 @@
 block discarded – undo
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]);
Please login to merge, or discard this patch.