Passed
Push — master ( bf2dba...dd09b0 )
by Tomáš
03:21
created
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/Import/Importer.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -118,8 +118,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/TournamentGenerator/Export/Hierarchy/Exporter.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,8 +92,7 @@
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
src/TournamentGenerator/Traits/WithTeams.php 2 patches
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.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -61,8 +61,7 @@  discard block
 block discarded – undo
61 61
 		$teams = $this->getTeams(true, Constants::SEED);
62 62
 		if ($this::isSeeded($teams)) {
63 63
 			Functions::sortAlternate($teams);
64
-		}
65
-		else {
64
+		} else {
66 65
 			shuffle($teams);
67 66
 		}
68 67
 
@@ -94,8 +93,7 @@  discard block
 block discarded – undo
94 93
 		}
95 94
 		if ($ordered) {
96 95
 			$returnTeams = $this->sortTeams($ordering);
97
-		}
98
-		else {
96
+		} else {
99 97
 			$returnTeams = $this->teams->unique()->get();
100 98
 		}
101 99
 
@@ -145,8 +143,7 @@  discard block
 block discarded – undo
145 143
 		if ($this instanceof WithGroupsInterface) {
146 144
 			$filter = new Filter($filters, $this->getGroups());
147 145
 			$filter->filter($teams);
148
-		}
149
-		else if ($this instanceof Group) {
146
+		} else if ($this instanceof Group) {
150 147
 			$filter = new Filter($filters, [$this]);
151 148
 			$filter->filter($teams);
152 149
 		}
Please login to merge, or discard this patch.
src/TournamentGenerator/Containers/ContainerQuery.php 1 patch
Braces   +7 added lines, -14 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
 		}
@@ -132,11 +130,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/TournamentGenerator/Round.php 2 patches
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.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -150,8 +150,7 @@
 block discarded – undo
150 150
 		$teams = $this->getTeams(true, Constants::SEED);
151 151
 		if ($this::isSeeded($teams)) {
152 152
 			Functions::sortAlternate($teams);
153
-		}
154
-		else {
153
+		} else {
155 154
 			shuffle($teams);
156 155
 		}
157 156
 
Please login to merge, or discard this patch.
src/TournamentGenerator/Helpers/Functions.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 * @return bool
24 24
 	 */
25 25
 	public static function isPowerOf2(int $x) : bool {
26
-		return ($x !== 0) && ($x & ($x - 1)) === 0;
26
+		return ($x !== 0) && ($x&($x-1)) === 0;
27 27
 	}
28 28
 
29 29
 	/**
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public static function previousPowerOf2(int $x) : int {
49 49
 		// Left bit shift by the bit length of the previous number
50
-		return 1 << (strlen(decbin($x)) - 1);
50
+		return 1 << (strlen(decbin($x))-1);
51 51
 	}
52 52
 
53 53
 	/**
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
 	public static function sortAlternate(array &$array) : array {
74 74
 		$new = [];
75 75
 		$new2 = [];
76
-		$count = count($array) / 2;
76
+		$count = count($array)/2;
77 77
 		for ($i = 0; $i < $count; $i++) {
78
-			if ($i % 2 === 0) {
78
+			if ($i%2 === 0) {
79 79
 				$new[] = array_shift($array);
80 80
 				$new[] = array_pop($array);
81 81
 			}
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,8 +78,7 @@
 block discarded – undo
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
 			}
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
@@ -71,8 +71,7 @@
 block discarded – undo
71 71
 			/** @infection-ignore-all */
72 72
 			$this->id = uniqid('', false);
73 73
 			throw new InvalidArgumentException('Unsupported id type ('.gettype($id).') - expected type of string or int');
74
-		}
75
-		else {
74
+		} else {
76 75
 			$this->id = $id;
77 76
 		}
78 77
 		return $this;
Please login to merge, or discard this patch.