@@ -43,11 +43,11 @@ |
||
43 | 43 | |
44 | 44 | private $groups = []; |
45 | 45 | |
46 | - function __construct(string $what = 'points', string $how = '>', $val = 0, $groups = []){ |
|
46 | + function __construct(string $what = 'points', string $how = '>', $val = 0, $groups = []) { |
|
47 | 47 | if (in_array(strtolower($what), ['points', 'score', 'wins', 'draws', 'losses', 'second', 'third', 'team', 'notprogressed', 'progressed'])) $this->what = strtolower($what); |
48 | 48 | if (in_array($how, ['>', '<', '>=', '<=', '=', '!='])) $this->how = $how; |
49 | 49 | if ((gettype($val) === 'integer' && strtolower($what) !== 'team') || ($val instanceof Team && strtolower($what) === 'team')) $this->val = $val; |
50 | - $this->groups = array_map(function($a) { return $a->id; }, array_filter($groups, function($a) {return ($a instanceof Group);})); |
|
50 | + $this->groups = array_map(function($a) { return $a->id; }, array_filter($groups, function($a) {return ($a instanceof Group); })); |
|
51 | 51 | } |
52 | 52 | public function __toString() { |
53 | 53 | return 'Filter: '.$this->what.' '.($this->what !== 'notprogressed' && $this->what !== 'progressed' ? $this->how.' '.$this->val : ''); |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | if ($a->groupResults[$group->id]["points"] === $b->groupResults[$group->id]["points"]) return ($a->groupResults[$group->id]["score"] > $b->groupResults[$group->id]["score"] ? -1 : 1); |
19 | 19 | return ($a->groupResults[$group->id]["points"] > $b->groupResults[$group->id]["points"] ? -1 : 1); |
20 | 20 | }); |
21 | - break;} |
|
21 | + break; } |
|
22 | 22 | case \TournamentGenerator\Constants::SCORE:{ |
23 | 23 | uasort($teams, function($a, $b) use ($group) { |
24 | 24 | if ($a->groupResults[$group->id]["score"] === $b->groupResults[$group->id]["score"]) return 0; |
25 | 25 | return ($a->groupResults[$group->id]["score"] > $b->groupResults[$group->id]["score"] ? -1 : 1); |
26 | 26 | }); |
27 | - break;} |
|
27 | + break; } |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | return $teams; |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | if ($a->sumPoints($groupsIds) === $b->sumPoints($groupsIds)) return ($a->sumScore($groupsIds) > $b->sumScore($groupsIds) ? -1 : 1); |
42 | 42 | return ($a->sumPoints($groupsIds) > $b->sumPoints($groupsIds) ? -1 : 1); |
43 | 43 | }); |
44 | - break;} |
|
44 | + break; } |
|
45 | 45 | case \TournamentGenerator\Constants::SCORE:{ |
46 | 46 | uasort($teams, function($a, $b) use ($groupsIds) { |
47 | 47 | if ($a->sumScore($groupsIds) === $b->sumScore($groupsIds)) return 0; |
48 | 48 | return ($a->sumScore($groupsIds) > $b->sumScore($groupsIds) ? -1 : 1); |
49 | 49 | }); |
50 | - break;} |
|
50 | + break; } |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | return $teams; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | // CYCLE 6 |
71 | 71 | // FIRST AVAILABLE GAME |
72 | - $this->moveCalculatedGames(array_shift($games),$teams); |
|
72 | + $this->moveCalculatedGames(array_shift($games), $teams); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | return $this->games; |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | private function cycle1(array &$games, array &$teams) { |
80 | 80 | $found = false; |
81 | 81 | foreach ($games as $key => $game) { |
82 | - if ($this->orderCheckTeamsVal($game, $teams, [4,5,6,7])) { |
|
83 | - $this->moveCalculatedGames($game,$teams); |
|
82 | + if ($this->orderCheckTeamsVal($game, $teams, [4, 5, 6, 7])) { |
|
83 | + $this->moveCalculatedGames($game, $teams); |
|
84 | 84 | unset($games[$key]); |
85 | 85 | $found = true; |
86 | 86 | break; |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | private function cycle2(array &$games, array &$teams) { |
93 | 93 | $found = false; |
94 | 94 | foreach ($games as $key => $game) { |
95 | - if ($this->orderCheckTeamsVal($game, $teams, [6,7])) { |
|
96 | - $this->moveCalculatedGames($game,$teams); |
|
95 | + if ($this->orderCheckTeamsVal($game, $teams, [6, 7])) { |
|
96 | + $this->moveCalculatedGames($game, $teams); |
|
97 | 97 | unset($games[$key]); |
98 | 98 | $found = true; |
99 | 99 | break; |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | private function cycle3(array &$games, array &$teams) { |
107 | 107 | $found = false; |
108 | 108 | foreach ($games as $key => $game) { |
109 | - if ($this->orderCheckTeamsVal($game, $teams, [7], [1,2,3])) { |
|
110 | - $this->moveCalculatedGames($game,$teams); |
|
109 | + if ($this->orderCheckTeamsVal($game, $teams, [7], [1, 2, 3])) { |
|
110 | + $this->moveCalculatedGames($game, $teams); |
|
111 | 111 | unset($games[$key]); |
112 | 112 | $found = true; |
113 | 113 | break; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $found = false; |
121 | 121 | foreach ($games as $key => $game) { |
122 | 122 | if ($this->orderCheckTeamsVal($game, $teams, [7])) { |
123 | - $this->moveCalculatedGames($game,$teams); |
|
123 | + $this->moveCalculatedGames($game, $teams); |
|
124 | 124 | unset($games[$key]); |
125 | 125 | $found = true; |
126 | 126 | break; |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | private function cycle5(array &$games, array &$teams) { |
133 | 133 | $found = false; |
134 | 134 | foreach ($games as $key => $game) { |
135 | - if ($this->orderCheckTeamsVal($game, $teams, [], [1,2,3])) { |
|
136 | - $this->moveCalculatedGames($game,$teams); |
|
135 | + if ($this->orderCheckTeamsVal($game, $teams, [], [1, 2, 3])) { |
|
136 | + $this->moveCalculatedGames($game, $teams); |
|
137 | 137 | unset($games[$key]); |
138 | 138 | $found = true; |
139 | 139 | break; |
@@ -18,11 +18,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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[] = \TournamentGenerator\Constants::DUMMY_TEAM; // IF NOT EVEN NUMBER OF TEAMS, ADD DUMMY |
|
168 | + if (count($teams)%2 != 0) $teams[] = \TournamentGenerator\Constants::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 |
||
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); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | return $this->name; |
24 | 24 | } |
25 | 25 | |
26 | - public function addGroup(Group ...$groups){ |
|
26 | + public function addGroup(Group ...$groups) { |
|
27 | 27 | foreach ($groups as $group) { |
28 | 28 | if ($group instanceof Group) $this->groups[] = $group; |
29 | 29 | else throw new \Exception('Trying to add group which is not an instance of Group class.'); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $this->groups[] = $g->setSkip($this->allowSkip); |
36 | 36 | return $g; |
37 | 37 | } |
38 | - public function getGroups(){ |
|
38 | + public function getGroups() { |
|
39 | 39 | $this->orderGroups(); |
40 | 40 | return $this->groups; |
41 | 41 | } |
@@ -44,16 +44,16 @@ discard block |
||
44 | 44 | return array_map(function($a) { return $a->id; }, $this->groups); |
45 | 45 | } |
46 | 46 | public function orderGroups() { |
47 | - usort($this->groups, function($a, $b){ |
|
48 | - return $a->order - $b->order; |
|
47 | + usort($this->groups, function($a, $b) { |
|
48 | + return $a->order-$b->order; |
|
49 | 49 | }); |
50 | 50 | } |
51 | 51 | |
52 | - public function allowSkip(){ |
|
52 | + public function allowSkip() { |
|
53 | 53 | $this->allowSkip = true; |
54 | 54 | return $this; |
55 | 55 | } |
56 | - public function disallowSkip(){ |
|
56 | + public function disallowSkip() { |
|
57 | 57 | $this->allowSkip = false; |
58 | 58 | return $this; |
59 | 59 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | return $this->allowSkip; |
66 | 66 | } |
67 | 67 | |
68 | - public function genGames(){ |
|
68 | + public function genGames() { |
|
69 | 69 | foreach ($this->groups as $group) { |
70 | 70 | $group->genGames(); |
71 | 71 | $this->games = array_merge($this->games, $group->orderGames()); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | public function getGames() { |
76 | 76 | return $this->games; |
77 | 77 | } |
78 | - public function isPlayed(){ |
|
78 | + public function isPlayed() { |
|
79 | 79 | foreach ($this->groups as $group) { |
80 | 80 | if (!$group->isPlayed()) return false; |
81 | 81 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | public function addTeam(...$teams) { |
86 | 86 | foreach ($teams as $team) { |
87 | - if ($team instanceof Team) { |
|
87 | + if ($team instanceof Team) { |
|
88 | 88 | $this->teams[] = $team; |
89 | 89 | } |
90 | 90 | elseif (gettype($team) === 'array') { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | return $this; |
154 | 154 | } |
155 | 155 | |
156 | - public function progress(bool $blank = false){ |
|
156 | + public function progress(bool $blank = false) { |
|
157 | 157 | foreach ($this->groups as $group) { |
158 | 158 | $group->progress($blank); |
159 | 159 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $this->name = $name; |
22 | 22 | } |
23 | 23 | |
24 | - public function addRound(Round ...$rounds){ |
|
24 | + public function addRound(Round ...$rounds) { |
|
25 | 25 | foreach ($rounds as $round) { |
26 | 26 | if ($round instanceof Round) $this->rounds[] = $round; |
27 | 27 | else throw new \Exception('Trying to add round which is not an instance of Round class.'); |
@@ -33,15 +33,15 @@ discard block |
||
33 | 33 | $this->rounds[] = $r->setSkip($this->allowSkip); |
34 | 34 | return $r; |
35 | 35 | } |
36 | - public function getRounds(){ |
|
36 | + public function getRounds() { |
|
37 | 37 | return $this->rounds; |
38 | 38 | } |
39 | 39 | |
40 | - public function allowSkip(){ |
|
40 | + public function allowSkip() { |
|
41 | 41 | $this->allowSkip = true; |
42 | 42 | return $this; |
43 | 43 | } |
44 | - public function disallowSkip(){ |
|
44 | + public function disallowSkip() { |
|
45 | 45 | $this->allowSkip = false; |
46 | 46 | return $this; |
47 | 47 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | public function addTeam(...$teams) { |
57 | 57 | foreach ($teams as $team) { |
58 | - if ($team instanceof Team) { |
|
58 | + if ($team instanceof Team) { |
|
59 | 59 | $this->teams[] = $team; |
60 | 60 | } |
61 | 61 | elseif (gettype($team) === 'array') { |
@@ -59,70 +59,70 @@ |
||
59 | 59 | return $this; |
60 | 60 | } |
61 | 61 | |
62 | - public function addWin(string $groupId = ''){ |
|
62 | + public function addWin(string $groupId = '') { |
|
63 | 63 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
64 | 64 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->winPoints; |
65 | 65 | $this->sumPoints += $this->groupResults[$groupId]['group']->winPoints; |
66 | 66 | $this->groupResults[$groupId]['wins']++; |
67 | 67 | return $this; |
68 | 68 | } |
69 | - public function removeWin(string $groupId = ''){ |
|
69 | + public function removeWin(string $groupId = '') { |
|
70 | 70 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
71 | 71 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->winPoints; |
72 | 72 | $this->sumPoints -= $this->groupResults[$groupId]['group']->winPoints; |
73 | 73 | $this->groupResults[$groupId]['wins']--; |
74 | 74 | return $this; |
75 | 75 | } |
76 | - public function addDraw(string $groupId = ''){ |
|
76 | + public function addDraw(string $groupId = '') { |
|
77 | 77 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
78 | 78 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->drawPoints; |
79 | 79 | $this->sumPoints += $this->groupResults[$groupId]['group']->drawPoints; |
80 | 80 | $this->groupResults[$groupId]['draws']++; |
81 | 81 | return $this; |
82 | 82 | } |
83 | - public function removeDraw(string $groupId = ''){ |
|
83 | + public function removeDraw(string $groupId = '') { |
|
84 | 84 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
85 | 85 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->drawPointsPoints; |
86 | 86 | $this->sumPoints -= $this->groupResults[$groupId]['group']->drawPoints; |
87 | 87 | $this->groupResults[$groupId]['draws']--; |
88 | 88 | return $this; |
89 | 89 | } |
90 | - public function addLoss(string $groupId = ''){ |
|
90 | + public function addLoss(string $groupId = '') { |
|
91 | 91 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
92 | 92 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->lostPoints; |
93 | 93 | $this->sumPoints += $this->groupResults[$groupId]['group']->lostPoints; |
94 | 94 | $this->groupResults[$groupId]['losses']++; |
95 | 95 | return $this; |
96 | 96 | } |
97 | - public function removeLoss(string $groupId = ''){ |
|
97 | + public function removeLoss(string $groupId = '') { |
|
98 | 98 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
99 | 99 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->lostPoints; |
100 | 100 | $this->sumPoints -= $this->groupResults[$groupId]['group']->lostPoints; |
101 | 101 | $this->groupResults[$groupId]['losses']--; |
102 | 102 | return $this; |
103 | 103 | } |
104 | - public function addSecond(string $groupId = ''){ |
|
104 | + public function addSecond(string $groupId = '') { |
|
105 | 105 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
106 | 106 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->secondPoints; |
107 | 107 | $this->sumPoints += $this->groupResults[$groupId]['group']->secondPoints; |
108 | 108 | $this->groupResults[$groupId]['second']++; |
109 | 109 | return $this; |
110 | 110 | } |
111 | - public function removeSecond(string $groupId = ''){ |
|
111 | + public function removeSecond(string $groupId = '') { |
|
112 | 112 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
113 | 113 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->secondPoints; |
114 | 114 | $this->sumPoints -= $this->groupResults[$groupId]['group']->secondPoints; |
115 | 115 | $this->groupResults[$groupId]['second']--; |
116 | 116 | return $this; |
117 | 117 | } |
118 | - public function addThird(string $groupId = ''){ |
|
118 | + public function addThird(string $groupId = '') { |
|
119 | 119 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
120 | 120 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->thirdPoints; |
121 | 121 | $this->sumPoints += $this->groupResults[$groupId]['group']->thirdPoints; |
122 | 122 | $this->groupResults[$groupId]['third']++; |
123 | 123 | return $this; |
124 | 124 | } |
125 | - public function removeThird(string $groupId = ''){ |
|
125 | + public function removeThird(string $groupId = '') { |
|
126 | 126 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
127 | 127 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->thirdPoints; |
128 | 128 | $this->sumPoints -= $this->groupResults[$groupId]['group']->thirdPoints; |
@@ -54,11 +54,11 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $groupIds = []; |
32 | 32 | $allGroups = []; |
33 | 33 | |
34 | - for ($i=1; $i <= $startGroups; $i++) { |
|
34 | + for ($i = 1; $i <= $startGroups; $i++) { |
|
35 | 35 | $g = $startRound->group([ |
36 | 36 | 'name' => 'Start group - '.$i, |
37 | 37 | 'inGame' => 2, |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | // SPLIT TEAMS EVENLY |
46 | 46 | $this->splitTeams(); |
47 | 47 | |
48 | - for ($r=2; $r <= $roundsNum-1; $r++) { |
|
48 | + for ($r = 2; $r <= $roundsNum-1; $r++) { |
|
49 | 49 | $groups = []; |
50 | 50 | $losingGroups = []; |
51 | 51 | $round = $this->round('Round '.$r); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | private function calcByes(int $countTeams, int &$nextPow) { |
90 | 90 | $byes = 0; |
91 | 91 | $nextPow = $countTeams; |
92 | - if ( !\TournamentGenerator\isPowerOf2($countTeams) ) { |
|
92 | + if (!\TournamentGenerator\isPowerOf2($countTeams)) { |
|
93 | 93 | $nextPow = bindec(str_pad(1, strlen(decbin($countTeams))+1, 0, STR_PAD_RIGHT)); |
94 | 94 | $byes = $nextPow-$countTeams; |
95 | 95 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | private function generateWinSide(int &$r, int &$byes, int &$countTeams, \TournamentGenerator\Round &$round, array &$allGroups, array &$groups, \TournamentGenerator\Group &$lastWinningGroup = null, array &$previousGroups = []) { |
99 | 99 | $order = 1; |
100 | - for ($g=1; $g <= (($countTeams+$byes)/pow(2, $r)); $g++) { |
|
100 | + for ($g = 1; $g <= (($countTeams+$byes)/pow(2, $r)); $g++) { |
|
101 | 101 | $group = $round->group([ |
102 | 102 | 'name' => 'Round '.$r.' - win '.$g, |
103 | 103 | 'inGame' => 2, |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $losingGroupTeamsCount = count($previousLosingGroups)+count($previousGroups); |
118 | 118 | $order = 2; |
119 | 119 | if (\TournamentGenerator\isPowerOf2($losingGroupTeamsCount)) { // IF THE NUMBER OF TEAMS IS A POWER OF 2, GENERATE GROUPS WITHOUT BYES |
120 | - for ($g=1; $g <= $losingGroupTeamsCount/2; $g++) { |
|
120 | + for ($g = 1; $g <= $losingGroupTeamsCount/2; $g++) { |
|
121 | 121 | $group = $round->group([ |
122 | 122 | 'name' => 'Round '.$r.' - loss '.$g, |
123 | 123 | 'inGame' => 2, |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | $n = (floor(count($previousLosingGroups)/2)+$losingByes); |
146 | 146 | $byesGroupsNums = []; |
147 | 147 | $byesProgressed = 0; |
148 | - for ($i=0; $i < $losingByes; $i++) { |
|
148 | + for ($i = 0; $i < $losingByes; $i++) { |
|
149 | 149 | $byesGroupsNums[] = $n-($i*2); |
150 | 150 | } |
151 | 151 | $lastGroup = 0; |
152 | - for ($g=1; $g <= ((count($previousLosingGroups)/2)+$losingByes); $g++) { |
|
152 | + for ($g = 1; $g <= ((count($previousLosingGroups)/2)+$losingByes); $g++) { |
|
153 | 153 | $group = $round->group([ |
154 | 154 | 'name' => 'Round '.$r.' - loss '.$g, |
155 | 155 | 'inGame' => 2, |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | } |
167 | 167 | else { |
168 | 168 | $previousLosingGroups[$lastGroup]->progression($group, 0, 1); // PROGRESS FROM LOSING GROUP BEFORE |
169 | - if (isset($previousLosingGroups[$lastGroup + 1])) $previousLosingGroups[$lastGroup + 1]->progression($group, 0, 1); // PROGREESS FROM LOSING GROUP BEFORE |
|
169 | + if (isset($previousLosingGroups[$lastGroup+1])) $previousLosingGroups[$lastGroup+1]->progression($group, 0, 1); // PROGREESS FROM LOSING GROUP BEFORE |
|
170 | 170 | $lastGroup += 2; |
171 | 171 | } |
172 | 172 | } |