@@ -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']; |