@@ -33,11 +33,17 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function progress(bool $blank = false) { |
| 36 | - if ($blank) $teams = $this->from->isPlayed() ? $this->from->sortTeams($this->filters) : $this->from->simulate($this->filters); |
|
| 37 | - else $teams = $this->from->sortTeams($this->filters); |
|
| 36 | + if ($blank) { |
|
| 37 | + $teams = $this->from->isPlayed() ? $this->from->sortTeams($this->filters) : $this->from->simulate($this->filters); |
|
| 38 | + } else { |
|
| 39 | + $teams = $this->from->sortTeams($this->filters); |
|
| 40 | + } |
|
| 38 | 41 | |
| 39 | - if (count($this->filters) === 0 || $this->len !== null || $this->start !== 0) $next = array_splice($teams, $this->start, ($this->len === null ? count($teams) : $this->len)); |
|
| 40 | - else $next = $teams; |
|
| 42 | + if (count($this->filters) === 0 || $this->len !== null || $this->start !== 0) { |
|
| 43 | + $next = array_splice($teams, $this->start, ($this->len === null ? count($teams) : $this->len)); |
|
| 44 | + } else { |
|
| 45 | + $next = $teams; |
|
| 46 | + } |
|
| 41 | 47 | |
| 42 | 48 | $i = 1; |
| 43 | 49 | |
@@ -45,12 +51,15 @@ discard block |
||
| 45 | 51 | if ($blank) { |
| 46 | 52 | $this->to->addTeam(new BlankTeam($this.' - '.$i, $team)); |
| 47 | 53 | $i++; |
| 54 | + } else { |
|
| 55 | + $team->sumPoints += $this->from->progressPoints; |
|
| 48 | 56 | } |
| 49 | - else $team->sumPoints += $this->from->progressPoints; |
|
| 50 | 57 | } |
| 51 | 58 | |
| 52 | 59 | $this->from->addProgressed($next); |
| 53 | - if (!$blank) $this->to->addTeam($next); |
|
| 60 | + if (!$blank) { |
|
| 61 | + $this->to->addTeam($next); |
|
| 62 | + } |
|
| 54 | 63 | return $this; |
| 55 | 64 | } |
| 56 | 65 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $this->name = $name; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - public function addRound(Round ...$rounds){ |
|
| 22 | + public function addRound(Round ...$rounds) { |
|
| 23 | 23 | foreach ($rounds as $round) { |
| 24 | 24 | if ($round instanceof Round) $this->rounds[] = $round; |
| 25 | 25 | else throw new \Exception('Trying to add round which is not an instance of Round class.'); |
@@ -31,15 +31,15 @@ discard block |
||
| 31 | 31 | $this->rounds[] = $r->setSkip($this->allowSkip); |
| 32 | 32 | return $r; |
| 33 | 33 | } |
| 34 | - public function getRounds(){ |
|
| 34 | + public function getRounds() { |
|
| 35 | 35 | return $this->rounds; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function allowSkip(){ |
|
| 38 | + public function allowSkip() { |
|
| 39 | 39 | $this->allowSkip = true; |
| 40 | 40 | return $this; |
| 41 | 41 | } |
| 42 | - public function disallowSkip(){ |
|
| 42 | + public function disallowSkip() { |
|
| 43 | 43 | $this->allowSkip = false; |
| 44 | 44 | return $this; |
| 45 | 45 | } |
@@ -21,8 +21,11 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | public function addRound(Round ...$rounds){ |
| 23 | 23 | foreach ($rounds as $round) { |
| 24 | - if ($round instanceof Round) $this->rounds[] = $round; |
|
| 25 | - else throw new \Exception('Trying to add round which is not an instance of Round class.'); |
|
| 24 | + if ($round instanceof Round) { |
|
| 25 | + $this->rounds[] = $round; |
|
| 26 | + } else { |
|
| 27 | + throw new \Exception('Trying to add round which is not an instance of Round class.'); |
|
| 28 | + } |
|
| 26 | 29 | } |
| 27 | 30 | return $this; |
| 28 | 31 | } |
@@ -63,7 +66,9 @@ discard block |
||
| 63 | 66 | return $t; |
| 64 | 67 | } |
| 65 | 68 | public function getTeams() { |
| 66 | - if (count($this->teams) > 0) return $this->teams; |
|
| 69 | + if (count($this->teams) > 0) { |
|
| 70 | + return $this->teams; |
|
| 71 | + } |
|
| 67 | 72 | $teams = []; |
| 68 | 73 | foreach ($this->rounds as $round) { |
| 69 | 74 | $teams = array_merge($teams, $round->getTeams()); |
@@ -82,7 +87,9 @@ discard block |
||
| 82 | 87 | |
| 83 | 88 | public function splitTeams(...$rounds) { |
| 84 | 89 | |
| 85 | - if (count($rounds) === 0) $rounds = $this->getRounds(); |
|
| 90 | + if (count($rounds) === 0) { |
|
| 91 | + $rounds = $this->getRounds(); |
|
| 92 | + } |
|
| 86 | 93 | |
| 87 | 94 | $teams = $this->getTeams(); |
| 88 | 95 | shuffle($teams); |
@@ -102,7 +109,9 @@ discard block |
||
| 102 | 109 | |
| 103 | 110 | public function genGamesSimulate() { |
| 104 | 111 | $games = []; |
| 105 | - if (count($this->rounds) <= 0) throw new \Exception('There are no rounds to simulate games from.'); |
|
| 112 | + if (count($this->rounds) <= 0) { |
|
| 113 | + throw new \Exception('There are no rounds to simulate games from.'); |
|
| 114 | + } |
|
| 106 | 115 | foreach ($this->rounds as $round) { |
| 107 | 116 | $games = array_merge($games, $round->genGames()); |
| 108 | 117 | $round->simulate()->progress(true)->resetGames(); |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | private $allowSkip = false; |
| 22 | 22 | |
| 23 | - function __construct(string $name = ''){ |
|
| 23 | + function __construct(string $name = '') { |
|
| 24 | 24 | $this->name = $name; |
| 25 | 25 | } |
| 26 | 26 | public function __toString() { |
@@ -63,16 +63,16 @@ discard block |
||
| 63 | 63 | public function getCategoryWait() { |
| 64 | 64 | return $this->expectedCategoryWait; |
| 65 | 65 | } |
| 66 | - public function getTournamentTime(){ |
|
| 66 | + public function getTournamentTime() { |
|
| 67 | 67 | $games = count($this->getGames()); |
| 68 | 68 | return $games*$this->expectedPlay+$games*$this->expectedGameWait+count($this->getRounds())*$this->expectedRoundWait+count($this->getCategories())*$this->expectedCategoryWait; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function allowSkip(){ |
|
| 71 | + public function allowSkip() { |
|
| 72 | 72 | $this->allowSkip = true; |
| 73 | 73 | return $this; |
| 74 | 74 | } |
| 75 | - public function disallowSkip(){ |
|
| 75 | + public function disallowSkip() { |
|
| 76 | 76 | $this->allowSkip = false; |
| 77 | 77 | return $this; |
| 78 | 78 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | return $this->allowSkip; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - public function addCategory(Category ...$categories){ |
|
| 87 | + public function addCategory(Category ...$categories) { |
|
| 88 | 88 | foreach ($categories as $category) { |
| 89 | 89 | if ($category instanceof Category) $this->categories[] = $category; |
| 90 | 90 | else throw new \Exception('Trying to add category which is not an instance of the Category class.'); |
@@ -86,8 +86,11 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | public function addCategory(Category ...$categories){ |
| 88 | 88 | foreach ($categories as $category) { |
| 89 | - if ($category instanceof Category) $this->categories[] = $category; |
|
| 90 | - else throw new \Exception('Trying to add category which is not an instance of the Category class.'); |
|
| 89 | + if ($category instanceof Category) { |
|
| 90 | + $this->categories[] = $category; |
|
| 91 | + } else { |
|
| 92 | + throw new \Exception('Trying to add category which is not an instance of the Category class.'); |
|
| 93 | + } |
|
| 91 | 94 | } |
| 92 | 95 | return $this; |
| 93 | 96 | } |
@@ -102,8 +105,11 @@ discard block |
||
| 102 | 105 | |
| 103 | 106 | public function addRound(Round ...$rounds) { |
| 104 | 107 | foreach ($rounds as $round) { |
| 105 | - if ($round instanceof Round) $this->rounds[] = $round; |
|
| 106 | - else throw new \Exception('Trying to add round which is not an instance of the Round class.'); |
|
| 108 | + if ($round instanceof Round) { |
|
| 109 | + $this->rounds[] = $round; |
|
| 110 | + } else { |
|
| 111 | + throw new \Exception('Trying to add round which is not an instance of the Round class.'); |
|
| 112 | + } |
|
| 107 | 113 | } |
| 108 | 114 | return $this; |
| 109 | 115 | } |
@@ -143,7 +149,9 @@ discard block |
||
| 143 | 149 | $teams = array_merge($teams, $round->getTeams()); |
| 144 | 150 | } |
| 145 | 151 | $this->teams = \array_unique($teams); |
| 146 | - if ($ordered) $this->sortTeams($ordering); |
|
| 152 | + if ($ordered) { |
|
| 153 | + $this->sortTeams($ordering); |
|
| 154 | + } |
|
| 147 | 155 | return $this->teams; |
| 148 | 156 | } |
| 149 | 157 | public function sortTeams($ordering = \TournamentGenerator\Constants::POINTS) { |
@@ -166,7 +174,9 @@ discard block |
||
| 166 | 174 | |
| 167 | 175 | public function splitTeams(Round ...$wheres) { |
| 168 | 176 | |
| 169 | - if (count($wheres) === 0) $wheres = $this->getRounds(); |
|
| 177 | + if (count($wheres) === 0) { |
|
| 178 | + $wheres = $this->getRounds(); |
|
| 179 | + } |
|
| 170 | 180 | |
| 171 | 181 | foreach ($wheres as $key => $value) { |
| 172 | 182 | if (gettype($value) === 'array') { |
@@ -181,7 +191,9 @@ discard block |
||
| 181 | 191 | |
| 182 | 192 | while (count($teams) > 0) { |
| 183 | 193 | foreach ($wheres as $where) { |
| 184 | - if (count($teams) > 0) $where->addTeam(array_shift($teams)); |
|
| 194 | + if (count($teams) > 0) { |
|
| 195 | + $where->addTeam(array_shift($teams)); |
|
| 196 | + } |
|
| 185 | 197 | } |
| 186 | 198 | } |
| 187 | 199 | foreach ($wheres as $where) { |
@@ -193,13 +205,17 @@ discard block |
||
| 193 | 205 | public function genGamesSimulate(bool $returnTime = false) { |
| 194 | 206 | $games = Utilis\Simulator::simulateTournament($this); |
| 195 | 207 | |
| 196 | - if ($returnTime) return $this->getTournamentTime(); |
|
| 208 | + if ($returnTime) { |
|
| 209 | + return $this->getTournamentTime(); |
|
| 210 | + } |
|
| 197 | 211 | return $games; |
| 198 | 212 | } |
| 199 | 213 | public function genGamesSimulateReal(bool $returnTime = false) { |
| 200 | 214 | $games = Utilis\Simulator::simulateTournamentReal($this); |
| 201 | 215 | |
| 202 | - if ($returnTime) return $this->getTournamentTime(); |
|
| 216 | + if ($returnTime) { |
|
| 217 | + return $this->getTournamentTime(); |
|
| 218 | + } |
|
| 203 | 219 | return $games; |
| 204 | 220 | } |
| 205 | 221 | |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | $this->splitTeams($round1); |
| 32 | 32 | |
| 33 | - if (count($this->getTeams()) % 4 == 2) { |
|
| 33 | + if (count($this->getTeams())%4 == 2) { |
|
| 34 | 34 | $group_top = $round2->group('TOP')->setType(\TournamentGenerator\Constants::ROUND_TWO); |
| 35 | 35 | |
| 36 | 36 | $filter_win_2 = new \TournamentGenerator\TeamFilter('wins', '=', 2, [$group_0_0, $group_top]); |
@@ -12,7 +12,9 @@ |
||
| 12 | 12 | |
| 13 | 13 | public function generate() { |
| 14 | 14 | |
| 15 | - if (count($this->getTeams()) === 0) throw new \Exception('Couldn\'t generate 2R2G tournament because there are no teams in the tournament.'); |
|
| 15 | + if (count($this->getTeams()) === 0) { |
|
| 16 | + throw new \Exception('Couldn\'t generate 2R2G tournament because there are no teams in the tournament.'); |
|
| 17 | + } |
|
| 16 | 18 | |
| 17 | 19 | |
| 18 | 20 | $round1 = $this->round('Round 1'); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | // CALCULATE BYES |
| 18 | 18 | $byes = 0; |
| 19 | - if ( !\TournamentGenerator\isPowerOf2($countTeams) ) { |
|
| 19 | + if (!\TournamentGenerator\isPowerOf2($countTeams)) { |
|
| 20 | 20 | $nextPow = bindec(str_pad(1, strlen(decbin($countTeams))+1, 0, STR_PAD_RIGHT)); |
| 21 | 21 | $byes = $nextPow-$countTeams; |
| 22 | 22 | } |
@@ -27,17 +27,17 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | $previousGroups = []; |
| 29 | 29 | |
| 30 | - for ($i=1; $i <= (($countTeams+$byes)/2); $i++) { |
|
| 30 | + for ($i = 1; $i <= (($countTeams+$byes)/2); $i++) { |
|
| 31 | 31 | $g = $startRound->group('Round 1 '.$i)->setInGame(2)->setType(\TournamentGenerator\Constants::ROUND_TWO); |
| 32 | 32 | $previousGroups[] = $g; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | $this->splitTeams(); |
| 36 | 36 | |
| 37 | - for ($r=2; $r <= $roundsNum; $r++) { |
|
| 37 | + for ($r = 2; $r <= $roundsNum; $r++) { |
|
| 38 | 38 | $groups = []; |
| 39 | 39 | $round = $this->round('Round '.$r); |
| 40 | - for ($g=1; $g <= (($countTeams+$byes)/pow(2, $r)); $g++) { |
|
| 40 | + for ($g = 1; $g <= (($countTeams+$byes)/pow(2, $r)); $g++) { |
|
| 41 | 41 | $group = $round->group('Round '.$r.' - '.$g)->setInGame(2)->setType(\TournamentGenerator\Constants::ROUND_TWO); |
| 42 | 42 | $groups[] = $group; |
| 43 | 43 | array_shift($previousGroups)->progression($group, 0, 1); // PROGRESS FROM GROUP BEFORE |
@@ -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('Start group - '.$i)->setInGame(2)->setType(\TournamentGenerator\Constants::ROUND_TWO); |
| 36 | 36 | $allGroups[] = $g; |
| 37 | 37 | $groupIds[] = $g->id; |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | // SPLIT TEAMS EVENLY |
| 42 | 42 | $this->splitTeams(); |
| 43 | 43 | |
| 44 | - for ($r=2; $r <= $roundsNum-1; $r++) { |
|
| 44 | + for ($r = 2; $r <= $roundsNum-1; $r++) { |
|
| 45 | 45 | $groups = []; |
| 46 | 46 | $losingGroups = []; |
| 47 | 47 | $round = $this->round('Round '.$r); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | private function calcByes(int $countTeams, int &$nextPow) { |
| 76 | 76 | $byes = 0; |
| 77 | 77 | $nextPow = $countTeams; |
| 78 | - if ( !\TournamentGenerator\isPowerOf2($countTeams) ) { |
|
| 78 | + if (!\TournamentGenerator\isPowerOf2($countTeams)) { |
|
| 79 | 79 | $nextPow = bindec(str_pad(1, strlen(decbin($countTeams))+1, 0, STR_PAD_RIGHT)); |
| 80 | 80 | $byes = $nextPow-$countTeams; |
| 81 | 81 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | private function generateWinSide(int &$r, int &$byes, int &$countTeams, \TournamentGenerator\Round &$round, array &$allGroups, array &$groups, \TournamentGenerator\Group &$lastWinningGroup = null, array &$previousGroups = []) { |
| 85 | 85 | $order = 1; |
| 86 | - for ($g=1; $g <= (($countTeams+$byes)/pow(2, $r)); $g++) { |
|
| 86 | + for ($g = 1; $g <= (($countTeams+$byes)/pow(2, $r)); $g++) { |
|
| 87 | 87 | $group = $round->group('Round '.$r.' - win '.$g)->setInGame(2)->setType(\TournamentGenerator\Constants::ROUND_TWO)->setOrder($order); |
| 88 | 88 | $allGroups[] = $group; |
| 89 | 89 | $order += 2; |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $losingGroupTeamsCount = count($previousLosingGroups)+count($previousGroups); |
| 99 | 99 | $order = 2; |
| 100 | 100 | if (\TournamentGenerator\isPowerOf2($losingGroupTeamsCount)) { // IF THE NUMBER OF TEAMS IS A POWER OF 2, GENERATE GROUPS WITHOUT BYES |
| 101 | - for ($g=1; $g <= $losingGroupTeamsCount/2; $g++) { |
|
| 101 | + for ($g = 1; $g <= $losingGroupTeamsCount/2; $g++) { |
|
| 102 | 102 | $group = $round->group('Round '.$r.' - loss '.$g)->setInGame(2)->setType(\TournamentGenerator\Constants::ROUND_TWO)->setOrder($order); |
| 103 | 103 | $allGroups[] = $group; |
| 104 | 104 | $order += 2; |
@@ -121,11 +121,11 @@ discard block |
||
| 121 | 121 | $n = (floor(count($previousLosingGroups)/2)+$losingByes); |
| 122 | 122 | $byesGroupsNums = []; |
| 123 | 123 | $byesProgressed = 0; |
| 124 | - for ($i=0; $i < $losingByes; $i++) { |
|
| 124 | + for ($i = 0; $i < $losingByes; $i++) { |
|
| 125 | 125 | $byesGroupsNums[] = $n-($i*2); |
| 126 | 126 | } |
| 127 | 127 | $lastGroup = 0; |
| 128 | - for ($g=1; $g <= ((count($previousLosingGroups)/2)+$losingByes); $g++) { |
|
| 128 | + for ($g = 1; $g <= ((count($previousLosingGroups)/2)+$losingByes); $g++) { |
|
| 129 | 129 | $group = $round->group('Round '.$r.' - loss '.$g)->setInGame(2)->setType(\TournamentGenerator\Constants::ROUND_TWO)->setOrder($order); |
| 130 | 130 | $allGroups[] = $group; |
| 131 | 131 | $order += 2; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | else { |
| 139 | 139 | $previousLosingGroups[$lastGroup]->progression($group, 0, 1); // PROGRESS FROM LOSING GROUP BEFORE |
| 140 | - if (isset($previousLosingGroups[$lastGroup + 1])) $previousLosingGroups[$lastGroup + 1]->progression($group, 0, 1); // PROGREESS FROM LOSING GROUP BEFORE |
|
| 140 | + if (isset($previousLosingGroups[$lastGroup+1])) $previousLosingGroups[$lastGroup+1]->progression($group, 0, 1); // PROGREESS FROM LOSING GROUP BEFORE |
|
| 141 | 141 | $lastGroup += 2; |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -13,7 +13,9 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | $countTeams = count($this->getTeams()); |
| 15 | 15 | |
| 16 | - if ($countTeams < 3) throw new \Exception('Double elimination is possible for minimum of 3 teams - '.$countTeams.' teams given.'); |
|
| 16 | + if ($countTeams < 3) { |
|
| 17 | + throw new \Exception('Double elimination is possible for minimum of 3 teams - '.$countTeams.' teams given.'); |
|
| 18 | + } |
|
| 17 | 19 | |
| 18 | 20 | |
| 19 | 21 | // CALCULATE BYES |
@@ -131,15 +133,19 @@ discard block |
||
| 131 | 133 | if ($r === 2) { // FIRST LOSING ROUND |
| 132 | 134 | $previousGroups[2*($g-1)]->progression($group, 1, 1); // PROGRESS FROM STARTING GROUP |
| 133 | 135 | $previousGroups[(2*($g-1))+1]->progression($group, 1, 1); // PROGREESS FROM STARTING GROUP |
| 134 | - } |
|
| 135 | - elseif ($losingGroupTeamsCount >= 2) { |
|
| 136 | + } elseif ($losingGroupTeamsCount >= 2) { |
|
| 136 | 137 | $previousLosingGroups[$g-1]->progression($group, 0, 1); // PROGRESS FROM LOSING GROUP BEFORE |
| 137 | - if (isset(array_reverse($previousGroups)[$g-1])) array_reverse($previousGroups)[$g-1]->progression($group, 1, 1); // PROGREESS FROM WINNING GROUP BEFORE |
|
| 138 | - else $previousLosingGroups[$g]->progression($group, 0, 1); // PROGRESS OTHER TEAM FROM LOSING GROUP BEEFORE |
|
| 138 | + if (isset(array_reverse($previousGroups)[$g-1])) { |
|
| 139 | + array_reverse($previousGroups)[$g-1]->progression($group, 1, 1); |
|
| 140 | + } |
|
| 141 | + // PROGREESS FROM WINNING GROUP BEFORE |
|
| 142 | + else { |
|
| 143 | + $previousLosingGroups[$g]->progression($group, 0, 1); |
|
| 144 | + } |
|
| 145 | + // PROGRESS OTHER TEAM FROM LOSING GROUP BEEFORE |
|
| 139 | 146 | } |
| 140 | 147 | } |
| 141 | - } |
|
| 142 | - else { // IF THE NUMBER OF TEAMS IS NOT A POWER OF 2, GENERATE GROUPS WITH BYES |
|
| 148 | + } else { // IF THE NUMBER OF TEAMS IS NOT A POWER OF 2, GENERATE GROUPS WITH BYES |
|
| 143 | 149 | // LOOK FOR THE CLOSEST LOWER POWER OF 2 |
| 144 | 150 | $losingByes = $losingGroupTeamsCount-bindec(str_pad(1, strlen(decbin($losingGroupTeamsCount)), 0, STR_PAD_RIGHT)); |
| 145 | 151 | $n = (floor(count($previousLosingGroups)/2)+$losingByes); |
@@ -163,10 +169,12 @@ discard block |
||
| 163 | 169 | if (in_array($g, $byesGroupsNums) && isset($previousGroups[$byesProgressed])) { // EMPTY GROUP FROM BYE |
| 164 | 170 | $previousGroups[$byesProgressed]->progression($group, 1, 1); // PROGRESS FROM WINNING GROUP BEFORE |
| 165 | 171 | $byesProgressed++; |
| 166 | - } |
|
| 167 | - else { |
|
| 172 | + } else { |
|
| 168 | 173 | $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 |
|
| 174 | + if (isset($previousLosingGroups[$lastGroup + 1])) { |
|
| 175 | + $previousLosingGroups[$lastGroup + 1]->progression($group, 0, 1); |
|
| 176 | + } |
|
| 177 | + // PROGREESS FROM LOSING GROUP BEFORE |
|
| 170 | 178 | $lastGroup += 2; |
| 171 | 179 | } |
| 172 | 180 | } |
@@ -263,13 +263,13 @@ discard block |
||
| 263 | 263 | $round1 = $tournament->round('Round1'); |
| 264 | 264 | $round2 = $tournament->round('Round1'); |
| 265 | 265 | |
| 266 | - $category1->addTeam(new \TournamentGenerator\Team('Team1'),new \TournamentGenerator\Team('Team2'),new \TournamentGenerator\Team('Team3')); |
|
| 267 | - $category2->addTeam(new \TournamentGenerator\Team('Team4'),new \TournamentGenerator\Team('Team5'),new \TournamentGenerator\Team('Team6')); |
|
| 266 | + $category1->addTeam(new \TournamentGenerator\Team('Team1'), new \TournamentGenerator\Team('Team2'), new \TournamentGenerator\Team('Team3')); |
|
| 267 | + $category2->addTeam(new \TournamentGenerator\Team('Team4'), new \TournamentGenerator\Team('Team5'), new \TournamentGenerator\Team('Team6')); |
|
| 268 | 268 | |
| 269 | - $round1->addTeam(new \TournamentGenerator\Team('Team7'),new \TournamentGenerator\Team('Team8'),new \TournamentGenerator\Team('Team9')); |
|
| 270 | - $round2->addTeam(new \TournamentGenerator\Team('Team10'),new \TournamentGenerator\Team('Team11'),new \TournamentGenerator\Team('Team12')); |
|
| 269 | + $round1->addTeam(new \TournamentGenerator\Team('Team7'), new \TournamentGenerator\Team('Team8'), new \TournamentGenerator\Team('Team9')); |
|
| 270 | + $round2->addTeam(new \TournamentGenerator\Team('Team10'), new \TournamentGenerator\Team('Team11'), new \TournamentGenerator\Team('Team12')); |
|
| 271 | 271 | |
| 272 | - $tournament->addTeam(new \TournamentGenerator\Team('Team13'),new \TournamentGenerator\Team('Team14'),new \TournamentGenerator\Team('Team15')); |
|
| 272 | + $tournament->addTeam(new \TournamentGenerator\Team('Team13'), new \TournamentGenerator\Team('Team14'), new \TournamentGenerator\Team('Team15')); |
|
| 273 | 273 | |
| 274 | 274 | $this->assertCount(15, $tournament->getTeams()); |
| 275 | 275 | // Test if teams does not duplicate |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | |
| 283 | 283 | $tournament = new \TournamentGenerator\Tournament('Name of tournament 1'); |
| 284 | 284 | |
| 285 | - for ($i=1; $i <= 8; $i++) { |
|
| 285 | + for ($i = 1; $i <= 8; $i++) { |
|
| 286 | 286 | $tournament->team('Team '.$i); |
| 287 | 287 | } |
| 288 | 288 | |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | |
| 304 | 304 | $tournament = new \TournamentGenerator\Tournament('Name of tournament 1'); |
| 305 | 305 | |
| 306 | - for ($i=1; $i <= 8; $i++) { |
|
| 306 | + for ($i = 1; $i <= 8; $i++) { |
|
| 307 | 307 | $tournament->team('Team '.$i); |
| 308 | 308 | } |
| 309 | 309 | |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | ->setGameWait(2) // SET TIME BETWEEN GAMES TO 2 MINUTES |
| 331 | 331 | ->setRoundWait(0); // SET TIME BETWEEN ROUNDS TO 0 MINUTES |
| 332 | 332 | |
| 333 | - for ($i=1; $i <= 8; $i++) { |
|
| 333 | + for ($i = 1; $i <= 8; $i++) { |
|
| 334 | 334 | $tournament->team('Team '.$i); |
| 335 | 335 | } |
| 336 | 336 | // Create a round and a final round |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | |
| 428 | 428 | $group = $round->group('Group name'); |
| 429 | 429 | |
| 430 | - for ($i=1; $i <= 4; $i++) { |
|
| 430 | + for ($i = 1; $i <= 4; $i++) { |
|
| 431 | 431 | $tournament->team('Team '.$i); |
| 432 | 432 | } |
| 433 | 433 | |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | |
| 461 | 461 | $group = $round->group('Group name'); |
| 462 | 462 | |
| 463 | - for ($i=1; $i <= 4; $i++) { |
|
| 463 | + for ($i = 1; $i <= 4; $i++) { |
|
| 464 | 464 | $tournament->team('Team '.$i); |
| 465 | 465 | } |
| 466 | 466 | |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | |
| 493 | 493 | $group = $round->group('Group name'); |
| 494 | 494 | |
| 495 | - for ($i=1; $i <= 4; $i++) { |
|
| 495 | + for ($i = 1; $i <= 4; $i++) { |
|
| 496 | 496 | $tournament->team('Team '.$i); |
| 497 | 497 | } |
| 498 | 498 | |