Completed
Push — master ( 592cb1...c155af )
by Tomáš
02:46
created
src/classes/class_generator.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
 		$this->group = $group;
19 19
 	}
20 20
 
21
-	public function allowSkip(){
21
+	public function allowSkip() {
22 22
 		$this->allowSkip = true;
23 23
 		return $this;
24 24
 	}
25
-	public function disallowSkip(){
25
+	public function disallowSkip() {
26 26
 		$this->allowSkip = false;
27 27
 		return $this;
28 28
 	}
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	}
46 46
 
47 47
 	public function setInGame(int $inGame) {
48
-		if ($inGame < 2 ||  $inGame > 4) throw new \Exception('Expected 2,3 or 4 as inGame '.$inGame.' given');
48
+		if ($inGame < 2 || $inGame > 4) throw new \Exception('Expected 2,3 or 4 as inGame '.$inGame.' given');
49 49
 		$this->inGame = $inGame;
50 50
 		return $this;
51 51
 	}
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 		$discard = [];
121 121
 		shuffle($teams);
122 122
 		$count = count($teams);
123
-		while (count($teams) % $this->inGame !== 0) { $discard[] = array_shift($teams); }
123
+		while (count($teams)%$this->inGame !== 0) { $discard[] = array_shift($teams); }
124 124
 
125 125
 		while (count($teams) > 0) {
126 126
 			$tInGame = [];
127
-			for ($i=0; $i < $this->inGame; $i++) { $tInGame[] = array_shift($teams); }
127
+			for ($i = 0; $i < $this->inGame; $i++) { $tInGame[] = array_shift($teams); }
128 128
 			$this->group->game($tInGame);
129 129
 		}
130 130
 
@@ -165,11 +165,11 @@  discard block
 block discarded – undo
165 165
 	public static function circle_genGames2(array $teams = [], \tournamentGenerator\Group $group) {
166 166
 		$bracket = []; // ARRAY OF GAMES
167 167
 
168
-		if (count($teams) % 2 != 0) $teams[] = \DUMMY_TEAM; // IF NOT EVEN NUMBER OF TEAMS, ADD DUMMY
168
+		if (count($teams)%2 != 0) $teams[] = \DUMMY_TEAM; // IF NOT EVEN NUMBER OF TEAMS, ADD DUMMY
169 169
 
170 170
 		shuffle($teams); // SHUFFLE TEAMS FOR MORE RANDOMNESS
171 171
 
172
-		for ($i=0; $i < count($teams)-1; $i++) {
172
+		for ($i = 0; $i < count($teams)-1; $i++) {
173 173
 			$bracket = array_merge($bracket, Generator::circle_saveBracket($teams, $group)); // SAVE CURRENT ROUND
174 174
 
175 175
 			$teams = Generator::circle_rotateBracket($teams); // ROTATE TEAMS IN BRACKET
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
 		$bracket = [];
185 185
 
186
-		for ($i=0; $i < count($teams)/2; $i++) { // GO THROUGH HALF OF THE TEAMS
186
+		for ($i = 0; $i < count($teams)/2; $i++) { // GO THROUGH HALF OF THE TEAMS
187 187
 
188 188
 			$home = $teams[$i];
189 189
 			$reverse = array_reverse($teams);
Please login to merge, or discard this patch.
src/classes/class_group.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 		return 'Group '.$this->name;
55 55
 	}
56 56
 
57
-	public function allowSkip(){
57
+	public function allowSkip() {
58 58
 		$this->generator->allowSkip();
59 59
 		return $this;
60 60
 	}
61
-	public function disallowSkip(){
61
+	public function disallowSkip() {
62 62
 		$this->generator->disallowSkip();
63 63
 		return $this;
64 64
 	}
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
 		$this->games[] = $g;
195 195
 		return $g;
196 196
 	}
197
-	public function addGame(...$games){
197
+	public function addGame(...$games) {
198 198
 		foreach ($games as $key => $game) {
199 199
 			if (gettype($game) === 'array') {
200 200
 				unset($games[$key]);
201
-				$this->games = array_merge($this->games, array_filter($game, function($a){ return ($a instanceof Game); }));
201
+				$this->games = array_merge($this->games, array_filter($game, function($a) { return ($a instanceof Game); }));
202 202
 				continue;
203 203
 			}
204 204
 			if (!$game instanceof Game) throw new \Exception('Trying to add game which is not instance of Game object.');
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		}
225 225
 		return $this;
226 226
 	}
227
-	public function isPlayed(){
227
+	public function isPlayed() {
228 228
 		foreach ($this->games as $game) {
229 229
 			if (!$game->isPlayed()) return false;
230 230
 		}
Please login to merge, or discard this patch.