@@ -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); |
@@ -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 | } |
@@ -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]); |
@@ -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->getId(); |
@@ -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 | } |
@@ -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 | $this->categories[] = $category; |
| 90 | 90 | } |
@@ -121,14 +121,14 @@ discard block |
||
| 121 | 121 | return $this->sumScore; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - public function addWin(string $groupId = ''){ |
|
| 124 | + public function addWin(string $groupId = '') { |
|
| 125 | 125 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
| 126 | 126 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->winPoints; |
| 127 | 127 | $this->sumPoints += $this->groupResults[$groupId]['group']->winPoints; |
| 128 | 128 | $this->groupResults[$groupId]['wins']++; |
| 129 | 129 | return $this; |
| 130 | 130 | } |
| 131 | - public function removeWin(string $groupId = ''){ |
|
| 131 | + public function removeWin(string $groupId = '') { |
|
| 132 | 132 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
| 133 | 133 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->winPoints; |
| 134 | 134 | $this->sumPoints -= $this->groupResults[$groupId]['group']->winPoints; |
@@ -136,14 +136,14 @@ discard block |
||
| 136 | 136 | return $this; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - public function addDraw(string $groupId = ''){ |
|
| 139 | + public function addDraw(string $groupId = '') { |
|
| 140 | 140 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
| 141 | 141 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->drawPoints; |
| 142 | 142 | $this->sumPoints += $this->groupResults[$groupId]['group']->drawPoints; |
| 143 | 143 | $this->groupResults[$groupId]['draws']++; |
| 144 | 144 | return $this; |
| 145 | 145 | } |
| 146 | - public function removeDraw(string $groupId = ''){ |
|
| 146 | + public function removeDraw(string $groupId = '') { |
|
| 147 | 147 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
| 148 | 148 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->drawPoints; |
| 149 | 149 | $this->sumPoints -= $this->groupResults[$groupId]['group']->drawPoints; |
@@ -151,14 +151,14 @@ discard block |
||
| 151 | 151 | return $this; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - public function addLoss(string $groupId = ''){ |
|
| 154 | + public function addLoss(string $groupId = '') { |
|
| 155 | 155 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
| 156 | 156 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->lostPoints; |
| 157 | 157 | $this->sumPoints += $this->groupResults[$groupId]['group']->lostPoints; |
| 158 | 158 | $this->groupResults[$groupId]['losses']++; |
| 159 | 159 | return $this; |
| 160 | 160 | } |
| 161 | - public function removeLoss(string $groupId = ''){ |
|
| 161 | + public function removeLoss(string $groupId = '') { |
|
| 162 | 162 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
| 163 | 163 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->lostPoints; |
| 164 | 164 | $this->sumPoints -= $this->groupResults[$groupId]['group']->lostPoints; |
@@ -166,14 +166,14 @@ discard block |
||
| 166 | 166 | return $this; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - public function addSecond(string $groupId = ''){ |
|
| 169 | + public function addSecond(string $groupId = '') { |
|
| 170 | 170 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
| 171 | 171 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->secondPoints; |
| 172 | 172 | $this->sumPoints += $this->groupResults[$groupId]['group']->secondPoints; |
| 173 | 173 | $this->groupResults[$groupId]['second']++; |
| 174 | 174 | return $this; |
| 175 | 175 | } |
| 176 | - public function removeSecond(string $groupId = ''){ |
|
| 176 | + public function removeSecond(string $groupId = '') { |
|
| 177 | 177 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
| 178 | 178 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->secondPoints; |
| 179 | 179 | $this->sumPoints -= $this->groupResults[$groupId]['group']->secondPoints; |
@@ -181,14 +181,14 @@ discard block |
||
| 181 | 181 | return $this; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - public function addThird(string $groupId = ''){ |
|
| 184 | + public function addThird(string $groupId = '') { |
|
| 185 | 185 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
| 186 | 186 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->thirdPoints; |
| 187 | 187 | $this->sumPoints += $this->groupResults[$groupId]['group']->thirdPoints; |
| 188 | 188 | $this->groupResults[$groupId]['third']++; |
| 189 | 189 | return $this; |
| 190 | 190 | } |
| 191 | - public function removeThird(string $groupId = ''){ |
|
| 191 | + public function removeThird(string $groupId = '') { |
|
| 192 | 192 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
| 193 | 193 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->thirdPoints; |
| 194 | 194 | $this->sumPoints -= $this->groupResults[$groupId]['group']->thirdPoints; |
@@ -66,14 +66,14 @@ discard block |
||
| 66 | 66 | if (count($error) > 0) throw new \Exception('Trying to add teams ('.count($error).') that are not instance of Team class'.PHP_EOL.print_r($error, true)); |
| 67 | 67 | return $this; |
| 68 | 68 | } |
| 69 | - public function getTeams(){ |
|
| 69 | + public function getTeams() { |
|
| 70 | 70 | return $this->teams; |
| 71 | 71 | } |
| 72 | - public function getTeamsIds(){ |
|
| 73 | - return array_map(function($a){ return $a->getId(); }, $this->teams); |
|
| 72 | + public function getTeamsIds() { |
|
| 73 | + return array_map(function($a) { return $a->getId(); }, $this->teams); |
|
| 74 | 74 | } |
| 75 | 75 | public function getTeam($id) { |
| 76 | - $key = array_search($id, array_map(function($a){ return $a->getId();}, $this->teams)); |
|
| 76 | + $key = array_search($id, array_map(function($a) { return $a->getId(); }, $this->teams)); |
|
| 77 | 77 | return ($key !== false ? $this->teams[$key] : false); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | return $this; |
| 111 | 111 | } |
| 112 | 112 | private function setResults2($i, $score, $results, $team) { |
| 113 | - if (count(array_filter($results, function($a) use ($score){return $a === $score;})) > 1) { |
|
| 113 | + if (count(array_filter($results, function($a) use ($score){return $a === $score; })) > 1) { |
|
| 114 | 114 | $this->drawIds[] = $team->getId(); |
| 115 | 115 | $team->addDraw($this->group->getId()); |
| 116 | 116 | $this->results[$team->getId()] += ['points' => $this->group->drawPoints, 'type' => 'draw']; |