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/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/Helpers/Generator.php 1 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/Import/ImportValidator.php 1 patch
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.
src/TournamentGenerator/Export/ExporterBase.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 	 *
43 43
 	 */
44 44
 	public function getJson() : string {
45
-		return json_encode($this->get(), JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES);
45
+		return json_encode($this->get(), JSON_THROW_ON_ERROR|JSON_UNESCAPED_SLASHES);
46 46
 	}
47 47
 
48 48
 	/**
Please login to merge, or discard this patch.
src/TournamentGenerator/Traits/WithTeams.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
 			shuffle($teams);
67 67
 		}
68 68
 
69
-		$split = ceil(count($teams) / count($wheres));
69
+		$split = ceil(count($teams)/count($wheres));
70 70
 		foreach ($wheres as $where) {
71 71
 			if (count($teams) > 0) {
72 72
 				$where->addTeam(...array_splice($teams, 0, $split));
Please login to merge, or discard this patch.
src/TournamentGenerator/Round.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	public function orderGroups() : array {
99 99
 		$groups = $this->getGroups();
100 100
 		usort($groups, static function($a, $b) {
101
-			return $a->getOrder() - $b->getOrder();
101
+			return $a->getOrder()-$b->getOrder();
102 102
 		});
103 103
 		return $groups;
104 104
 	}
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 			shuffle($teams);
156 156
 		}
157 157
 
158
-		$split = ceil(count($teams) / count($groups));
158
+		$split = ceil(count($teams)/count($groups));
159 159
 		foreach ($groups as $where) {
160 160
 			if (count($teams) > 0) {
161 161
 				$where->addTeam(...array_splice($teams, 0, $split));
Please login to merge, or discard this patch.