Passed
Push — master ( 1c4bf0...cbe06d )
by Tomáš
02:43
created
src/TournamentGenerator/Tournament.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@
 block discarded – undo
155 155
 	 */
156 156
 	public function getTournamentTime() : int {
157 157
 		$games = count($this->getGames());
158
-		return $games * $this->expectedPlay + ($games - 1) * $this->expectedGameWait + (count($this->getRounds()) - 1) * $this->expectedRoundWait + (count($this->getCategories()) - 1) * $this->expectedCategoryWait;
158
+		return $games*$this->expectedPlay+($games-1)*$this->expectedGameWait+(count($this->getRounds())-1)*$this->expectedRoundWait+(count($this->getCategories())-1)*$this->expectedCategoryWait;
159 159
 	}
160 160
 
161 161
 	/**
Please login to merge, or discard this patch.
src/TournamentGenerator/Helpers/FilterComparator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@
 block discarded – undo
121 121
 		foreach ($groupsId as $id) {
122 122
 			$games += count($team->getGames(null, $id));
123 123
 		}
124
-		return self::calcSum($team, $groupsId) / $games;
124
+		return self::calcSum($team, $groupsId)/$games;
125 125
 	}
126 126
 
127 127
 	/**
Please login to merge, or discard this patch.
src/TournamentGenerator/Helpers/Generator.php 2 patches
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.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -178,14 +178,14 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	public static function circle_genGames2(Group $group, array $teams = []) : array {
180 180
 
181
-		if (count($teams) % 2 !== 0) {
181
+		if (count($teams)%2 !== 0) {
182 182
 			$teams[] = Constants::DUMMY_TEAM;
183 183
 		} // IF NOT EVEN NUMBER OF TEAMS, ADD DUMMY
184 184
 
185 185
 		shuffle($teams); // SHUFFLE TEAMS FOR MORE RANDOMNESS
186 186
 
187 187
 		$rounds = [];
188
-		for ($i = 0; $i < count($teams) - 1; $i++) {
188
+		for ($i = 0; $i < count($teams)-1; $i++) {
189 189
 			$rounds[] = self::circle_saveBracket($teams, $group); // SAVE CURRENT ROUND
190 190
 
191 191
 			$teams = self::circle_rotateBracket($teams); // ROTATE TEAMS IN BRACKET
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
 		$bracket = [];
209 209
 
210
-		for ($i = 0; $i < count($teams) / 2; $i++) { // GO THROUGH HALF OF THE TEAMS
210
+		for ($i = 0; $i < count($teams)/2; $i++) { // GO THROUGH HALF OF THE TEAMS
211 211
 
212 212
 			$home = $teams[$i];
213 213
 			$reverse = array_reverse($teams);
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	public static function circle_rotateBracket(array $teams) : array {
236 236
 
237 237
 		$first = array_shift($teams); // THE FIRST TEAM REMAINS FIRST
238
-		$last = array_shift($teams);  // THE SECOND TEAM MOVES TO LAST PLACE
238
+		$last = array_shift($teams); // THE SECOND TEAM MOVES TO LAST PLACE
239 239
 
240 240
 		return array_merge([$first], $teams, [$last]); // MERGE BACK TOGETHER
241 241
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 		shuffle($teams);
305 305
 		$count = count($teams); // Store original count for exception
306 306
 
307
-		$discard = array_splice($teams, 0, $count % $this->inGame);
307
+		$discard = array_splice($teams, 0, $count%$this->inGame);
308 308
 
309 309
 		$teams = $this->saveTwoTwoGames($teams);
310 310
 
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 			$games = [];
334 334
 
335 335
 			// Split teams into chunks of maximum size
336
-			$groups = array_chunk($teams, (int) ceil($count / ceil($count / $this->maxSize)));
336
+			$groups = array_chunk($teams, (int) ceil($count/ceil($count/$this->maxSize)));
337 337
 			// Generate games for each chunk
338 338
 			foreach ($groups as $group) {
339 339
 				$games[] = $this->r_rGames($group);
Please login to merge, or discard this patch.
src/TournamentGenerator/Game.php 2 patches
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.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -202,7 +202,7 @@
 block discarded – undo
202 202
 	public function getTeam($id) : ?Team {
203 203
 		$key = array_search($id, array_map(static function($a) {
204 204
 			return $a->getId();
205
-		}, $this->teams),   true);
205
+		}, $this->teams), true);
206 206
 		return ($key !== false ? $this->teams[$key] : null);
207 207
 	}
208 208
 
Please login to merge, or discard this patch.
src/TournamentGenerator/Preset/R2G.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,14 +50,14 @@
 block discarded – undo
50 50
 
51 51
 		$this->splitTeams($round1);
52 52
 
53
-		if (count($this->getTeams()) % 4 === 2) {
53
+		if (count($this->getTeams())%4 === 2) {
54 54
 			$group_top = $round2->group('TOP')->setType(Constants::ROUND_TWO);
55 55
 
56 56
 			$filter_win_2 = new TeamFilter('wins', '=', 2, [$group_0_0, $group_top]);
57 57
 			$filter_loss_2 = new TeamFilter('losses', '=', 2, [$group_0_0, $group_top]);
58 58
 			$filter_win_1_both = new TeamFilter('wins', '=', 1, [$group_0_0, $group_top]);
59 59
 			$filter_loss_1_both = new TeamFilter('losses', '=', 1, [$group_0_0, $group_top]);
60
-			$group_0_0->progression($group_top, 0, 1)->addFilter($filter_win_1);  // PROGRESS THE BEST WINNING TEAM
60
+			$group_0_0->progression($group_top, 0, 1)->addFilter($filter_win_1); // PROGRESS THE BEST WINNING TEAM
61 61
 			$group_0_0->progression($group_top, 0, 1)->addFilter($filter_loss_1); // PROGRESS THE BEST LOSING TEAM
62 62
 			$group_top->progression($group_2_0)->addFilter($filter_win_2);
63 63
 			$group_top->progression($group_0_2)->addFilter($filter_loss_2);
Please login to merge, or discard this patch.
src/TournamentGenerator/Preset/SingleElimination.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
 		$byes = 0;
34 34
 		if (!Functions::isPowerOf2($countTeams)) {
35 35
 			$nextPow = Functions::nextPowerOf2($countTeams);
36
-			$byes = $nextPow - $countTeams;
36
+			$byes = $nextPow-$countTeams;
37 37
 		}
38 38
 
39
-		$roundsNum = log($countTeams + $byes, 2); // NUMBER OF ROUNDS
39
+		$roundsNum = log($countTeams+$byes, 2); // NUMBER OF ROUNDS
40 40
 
41 41
 		$startRound = $this->round('Start');
42 42
 
43 43
 		$previousGroups = [];
44 44
 
45
-		for ($i = 1; $i <= (($countTeams + $byes) / 2); $i++) {
45
+		for ($i = 1; $i <= (($countTeams+$byes)/2); $i++) {
46 46
 			$g = $startRound->group('Round 1 '.$i)->setInGame(2)->setType(Constants::ROUND_TWO);
47 47
 			$previousGroups[] = $g;
48 48
 		}
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		for ($r = 2; $r <= $roundsNum; $r++) {
53 53
 			$groups = [];
54 54
 			$round = $this->round('Round '.$r);
55
-			for ($g = 1; $g <= (($countTeams + $byes) / (2 ** $r)); $g++) {
55
+			for ($g = 1; $g <= (($countTeams+$byes)/(2 ** $r)); $g++) {
56 56
 				$group = $round->group('Round '.$r.' - '.$g)->setInGame(2)->setType(Constants::ROUND_TWO);
57 57
 				$groups[] = $group;
58 58
 				array_shift($previousGroups)->progression($group, 0, 1); // PROGRESS FROM GROUP BEFORE
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/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 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -564,7 +564,7 @@
 block discarded – undo
564 564
 	 * @return bool
565 565
 	 */
566 566
 	public static function isObject($data) : bool {
567
-		return is_object($data) || (is_array($data) && !empty($data) && array_keys($data) !== range(0, count($data) - 1));
567
+		return is_object($data) || (is_array($data) && !empty($data) && array_keys($data) !== range(0, count($data)-1));
568 568
 	}
569 569
 
570 570
 	/**
Please login to merge, or discard this 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.