@@ -28,11 +28,11 @@ discard block  | 
                                                    ||
| 28 | 28 | $this->setId(isset($id) ? $id : uniqid());  | 
                                                        
| 29 | 29 | }  | 
                                                        
| 30 | 30 | |
| 31 | -	public function allowSkip(){ | 
                                                        |
| 31 | +	public function allowSkip() { | 
                                                        |
| 32 | 32 | $this->generator->allowSkip();  | 
                                                        
| 33 | 33 | return $this;  | 
                                                        
| 34 | 34 | }  | 
                                                        
| 35 | -	public function disallowSkip(){ | 
                                                        |
| 35 | +	public function disallowSkip() { | 
                                                        |
| 36 | 36 | $this->generator->disallowSkip();  | 
                                                        
| 37 | 37 | return $this;  | 
                                                        
| 38 | 38 | }  | 
                                                        
@@ -184,9 +184,9 @@ discard block  | 
                                                    ||
| 184 | 184 | return $this;  | 
                                                        
| 185 | 185 | }  | 
                                                        
| 186 | 186 |  	public function addProgressed(...$teams) { | 
                                                        
| 187 | -		$this->progressed = array_merge($this->progressed, array_map(function ($a) {return $a->getId();}, array_filter($teams, function($a){return $a instanceof Team;}))); | 
                                                        |
| 188 | -		foreach (array_filter($teams, function($a){return is_array($a);}) as $team) { | 
                                                        |
| 189 | -			$this->progressed = array_merge($this->progressed, array_map(function ($a) {return $a->getId();}, array_filter($team, function($a) { | 
                                                        |
| 187 | +		$this->progressed = array_merge($this->progressed, array_map(function($a) {return $a->getId(); }, array_filter($teams, function($a) {return $a instanceof Team; }))); | 
                                                        |
| 188 | +		foreach (array_filter($teams, function($a) {return is_array($a); }) as $team) { | 
                                                        |
| 189 | +			$this->progressed = array_merge($this->progressed, array_map(function($a) {return $a->getId(); }, array_filter($team, function($a) { | 
                                                        |
| 190 | 190 | return ($a instanceof Team);  | 
                                                        
| 191 | 191 | })));  | 
                                                        
| 192 | 192 | }  | 
                                                        
@@ -206,11 +206,11 @@ discard block  | 
                                                    ||
| 206 | 206 | $this->games[] = $g;  | 
                                                        
| 207 | 207 | return $g;  | 
                                                        
| 208 | 208 | }  | 
                                                        
| 209 | -	public function addGame(...$games){ | 
                                                        |
| 210 | -		$this->games = array_merge($this->games, array_filter($games, function($a){ return ($a instanceof Game); })); | 
                                                        |
| 209 | +	public function addGame(...$games) { | 
                                                        |
| 210 | +		$this->games = array_merge($this->games, array_filter($games, function($a) { return ($a instanceof Game); })); | 
                                                        |
| 211 | 211 | |
| 212 | -		foreach (array_filter($games, function($a){return is_array($a);}) as $key => $game) { | 
                                                        |
| 213 | -			$this->games = array_merge($this->games, array_filter($game, function($a){ return ($a instanceof Game); })); | 
                                                        |
| 212 | +		foreach (array_filter($games, function($a) {return is_array($a); }) as $key => $game) { | 
                                                        |
| 213 | +			$this->games = array_merge($this->games, array_filter($game, function($a) { return ($a instanceof Game); })); | 
                                                        |
| 214 | 214 | }  | 
                                                        
| 215 | 215 | return $this;  | 
                                                        
| 216 | 216 | }  | 
                                                        
@@ -232,7 +232,7 @@ discard block  | 
                                                    ||
| 232 | 232 | }  | 
                                                        
| 233 | 233 | return $this;  | 
                                                        
| 234 | 234 | }  | 
                                                        
| 235 | -	public function isPlayed(){ | 
                                                        |
| 235 | +	public function isPlayed() { | 
                                                        |
| 236 | 236 | if (count($this->games) === 0) return false;  | 
                                                        
| 237 | 237 |  		foreach ($this->games as $game) { | 
                                                        
| 238 | 238 | if (!$game->isPlayed()) return false;  | 
                                                        
@@ -14,20 +14,20 @@  | 
                                                    ||
| 14 | 14 | private $sumScore = 0;  | 
                                                        
| 15 | 15 | |
| 16 | 16 | /**  | 
                                                        
| 17 | - * ARRAY WITH GROUPS AND IT'S RESULTS  | 
                                                        |
| 18 | - * array (  | 
                                                        |
| 19 | - * * groupId => array (  | 
                                                        |
| 20 | - * * * "group" => Group, # GROUP OBJECT  | 
                                                        |
| 21 | - * * * "points" => int 0, # NUMBER OF POINTS AQUIRED  | 
                                                        |
| 22 | - * * * "score" => int 0, # SUM OF SCORE AQUIRED  | 
                                                        |
| 23 | - * * * "wins" => int 0, # NUMBER OF WINS  | 
                                                        |
| 24 | - * * * "draws" => int 0, # NUMBER OF DRAWS  | 
                                                        |
| 25 | - * * * "losses" => int 0, # NUMBER OF LOSSES  | 
                                                        |
| 26 | - * * * "second" => int 0, # NUMBER OF TIMES BEING SECOND (ONLY FOR INGAME OPTION OF 3 OR 4)  | 
                                                        |
| 27 | - * * * "third" => int 0 # NUMBER OF TIMES BEING THIRD (ONLY FOR INGAME OPTION OF 4)  | 
                                                        |
| 28 | - * * )  | 
                                                        |
| 29 | - *)  | 
                                                        |
| 30 | - */  | 
                                                        |
| 17 | + * ARRAY WITH GROUPS AND IT'S RESULTS  | 
                                                        |
| 18 | + * array (  | 
                                                        |
| 19 | + * * groupId => array (  | 
                                                        |
| 20 | + * * * "group" => Group, # GROUP OBJECT  | 
                                                        |
| 21 | + * * * "points" => int 0, # NUMBER OF POINTS AQUIRED  | 
                                                        |
| 22 | + * * * "score" => int 0, # SUM OF SCORE AQUIRED  | 
                                                        |
| 23 | + * * * "wins" => int 0, # NUMBER OF WINS  | 
                                                        |
| 24 | + * * * "draws" => int 0, # NUMBER OF DRAWS  | 
                                                        |
| 25 | + * * * "losses" => int 0, # NUMBER OF LOSSES  | 
                                                        |
| 26 | + * * * "second" => int 0, # NUMBER OF TIMES BEING SECOND (ONLY FOR INGAME OPTION OF 3 OR 4)  | 
                                                        |
| 27 | + * * * "third" => int 0 # NUMBER OF TIMES BEING THIRD (ONLY FOR INGAME OPTION OF 4)  | 
                                                        |
| 28 | + * * )  | 
                                                        |
| 29 | + *)  | 
                                                        |
| 30 | + */  | 
                                                        |
| 31 | 31 | public $groupResults = [];  | 
                                                        
| 32 | 32 | |
| 33 | 33 |  	function __construct(string $name = 'team', $id = null) { | 
                                                        
@@ -104,14 +104,14 @@ discard block  | 
                                                    ||
| 104 | 104 | return $this->sumScore;  | 
                                                        
| 105 | 105 | }  | 
                                                        
| 106 | 106 | |
| 107 | -	public function addWin(string $groupId = ''){ | 
                                                        |
| 107 | +	public function addWin(string $groupId = '') { | 
                                                        |
| 108 | 108 |  		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        
| 109 | 109 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->getWinPoints();  | 
                                                        
| 110 | 110 | $this->sumPoints += $this->groupResults[$groupId]['group']->getWinPoints();  | 
                                                        
| 111 | 111 | $this->groupResults[$groupId]['wins']++;  | 
                                                        
| 112 | 112 | return $this;  | 
                                                        
| 113 | 113 | }  | 
                                                        
| 114 | -	public function removeWin(string $groupId = ''){ | 
                                                        |
| 114 | +	public function removeWin(string $groupId = '') { | 
                                                        |
| 115 | 115 |  		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        
| 116 | 116 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->getWinPoints();  | 
                                                        
| 117 | 117 | $this->sumPoints -= $this->groupResults[$groupId]['group']->getWinPoints();  | 
                                                        
@@ -119,14 +119,14 @@ discard block  | 
                                                    ||
| 119 | 119 | return $this;  | 
                                                        
| 120 | 120 | }  | 
                                                        
| 121 | 121 | |
| 122 | -	public function addDraw(string $groupId = ''){ | 
                                                        |
| 122 | +	public function addDraw(string $groupId = '') { | 
                                                        |
| 123 | 123 |  		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        
| 124 | 124 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->getDrawPoints();  | 
                                                        
| 125 | 125 | $this->sumPoints += $this->groupResults[$groupId]['group']->getDrawPoints();  | 
                                                        
| 126 | 126 | $this->groupResults[$groupId]['draws']++;  | 
                                                        
| 127 | 127 | return $this;  | 
                                                        
| 128 | 128 | }  | 
                                                        
| 129 | -	public function removeDraw(string $groupId = ''){ | 
                                                        |
| 129 | +	public function removeDraw(string $groupId = '') { | 
                                                        |
| 130 | 130 |  		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        
| 131 | 131 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->getDrawPoints();  | 
                                                        
| 132 | 132 | $this->sumPoints -= $this->groupResults[$groupId]['group']->getDrawPoints();  | 
                                                        
@@ -134,14 +134,14 @@ discard block  | 
                                                    ||
| 134 | 134 | return $this;  | 
                                                        
| 135 | 135 | }  | 
                                                        
| 136 | 136 | |
| 137 | -	public function addLoss(string $groupId = ''){ | 
                                                        |
| 137 | +	public function addLoss(string $groupId = '') { | 
                                                        |
| 138 | 138 |  		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        
| 139 | 139 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->getLostPoints();  | 
                                                        
| 140 | 140 | $this->sumPoints += $this->groupResults[$groupId]['group']->getLostPoints();  | 
                                                        
| 141 | 141 | $this->groupResults[$groupId]['losses']++;  | 
                                                        
| 142 | 142 | return $this;  | 
                                                        
| 143 | 143 | }  | 
                                                        
| 144 | -	public function removeLoss(string $groupId = ''){ | 
                                                        |
| 144 | +	public function removeLoss(string $groupId = '') { | 
                                                        |
| 145 | 145 |  		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        
| 146 | 146 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->getLostPoints();  | 
                                                        
| 147 | 147 | $this->sumPoints -= $this->groupResults[$groupId]['group']->getLostPoints();  | 
                                                        
@@ -149,14 +149,14 @@ discard block  | 
                                                    ||
| 149 | 149 | return $this;  | 
                                                        
| 150 | 150 | }  | 
                                                        
| 151 | 151 | |
| 152 | -	public function addSecond(string $groupId = ''){ | 
                                                        |
| 152 | +	public function addSecond(string $groupId = '') { | 
                                                        |
| 153 | 153 |  		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        
| 154 | 154 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->getSecondPoints();  | 
                                                        
| 155 | 155 | $this->sumPoints += $this->groupResults[$groupId]['group']->getSecondPoints();  | 
                                                        
| 156 | 156 | $this->groupResults[$groupId]['second']++;  | 
                                                        
| 157 | 157 | return $this;  | 
                                                        
| 158 | 158 | }  | 
                                                        
| 159 | -	public function removeSecond(string $groupId = ''){ | 
                                                        |
| 159 | +	public function removeSecond(string $groupId = '') { | 
                                                        |
| 160 | 160 |  		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        
| 161 | 161 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->getSecondPoints();  | 
                                                        
| 162 | 162 | $this->sumPoints -= $this->groupResults[$groupId]['group']->getSecondPoints();  | 
                                                        
@@ -164,14 +164,14 @@ discard block  | 
                                                    ||
| 164 | 164 | return $this;  | 
                                                        
| 165 | 165 | }  | 
                                                        
| 166 | 166 | |
| 167 | -	public function addThird(string $groupId = ''){ | 
                                                        |
| 167 | +	public function addThird(string $groupId = '') { | 
                                                        |
| 168 | 168 |  		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        
| 169 | 169 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->getThirdPoints();  | 
                                                        
| 170 | 170 | $this->sumPoints += $this->groupResults[$groupId]['group']->getThirdPoints();  | 
                                                        
| 171 | 171 | $this->groupResults[$groupId]['third']++;  | 
                                                        
| 172 | 172 | return $this;  | 
                                                        
| 173 | 173 | }  | 
                                                        
| 174 | -	public function removeThird(string $groupId = ''){ | 
                                                        |
| 174 | +	public function removeThird(string $groupId = '') { | 
                                                        |
| 175 | 175 |  		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        
| 176 | 176 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->getThirdPoints();  | 
                                                        
| 177 | 177 | $this->sumPoints -= $this->groupResults[$groupId]['group']->getThirdPoints();  | 
                                                        
@@ -53,20 +53,26 @@ discard block  | 
                                                    ||
| 53 | 53 | }  | 
                                                        
| 54 | 54 |  	public function getGroupResults($groupId = null) { | 
                                                        
| 55 | 55 |  		if (isset($groupId)) { | 
                                                        
| 56 | -			if (!isset($this->groupResults[$groupId])) throw new \Exception('Trying to get unexisting group results ('.$groupId.')'); | 
                                                        |
| 56 | +			if (!isset($this->groupResults[$groupId])) { | 
                                                        |
| 57 | +				throw new \Exception('Trying to get unexisting group results ('.$groupId.')'); | 
                                                        |
| 58 | + }  | 
                                                        |
| 57 | 59 | return $this->groupResults[$groupId];  | 
                                                        
| 58 | 60 | }  | 
                                                        
| 59 | 61 | return $this->groupResults;  | 
                                                        
| 60 | 62 | }  | 
                                                        
| 61 | 63 | |
| 62 | 64 |  	public function addGameWith(Team $team, Group $group) { | 
                                                        
| 63 | - if (!isset($this->gamesWith[$group->getId()][$team->getId()])) $this->gamesWith[$group->getId()][$team->getId()] = 0;  | 
                                                        |
| 65 | +		if (!isset($this->gamesWith[$group->getId()][$team->getId()])) { | 
                                                        |
| 66 | + $this->gamesWith[$group->getId()][$team->getId()] = 0;  | 
                                                        |
| 67 | + }  | 
                                                        |
| 64 | 68 | $this->gamesWith[$group->getId()][$team->getId()]++;  | 
                                                        
| 65 | 69 | return $this;  | 
                                                        
| 66 | 70 | }  | 
                                                        
| 67 | 71 |  	public function getGameWith(Team $team = null, Group $group = null) { | 
                                                        
| 68 | 72 |  		if (isset($group)) { | 
                                                        
| 69 | - if (isset($team)) return $this->gamesWith[$group->getId()][$team->getId()];  | 
                                                        |
| 73 | +			if (isset($team)) { | 
                                                        |
| 74 | + return $this->gamesWith[$group->getId()][$team->getId()];  | 
                                                        |
| 75 | + }  | 
                                                        |
| 70 | 76 | return $this->gamesWith[$group->getId()];  | 
                                                        
| 71 | 77 | }  | 
                                                        
| 72 | 78 |  		if (isset($team)) { | 
                                                        
@@ -75,25 +81,35 @@ discard block  | 
                                                    ||
| 75 | 81 |  				$filter = array_filter($games, function($key) use ($team){ | 
                                                        
| 76 | 82 | return $key === $team->getId();  | 
                                                        
| 77 | 83 | }, ARRAY_FILTER_USE_KEY);  | 
                                                        
| 78 | - if (count($filter) > 0) $return[$id] = $filter;  | 
                                                        |
| 84 | +				if (count($filter) > 0) { | 
                                                        |
| 85 | + $return[$id] = $filter;  | 
                                                        |
| 86 | + }  | 
                                                        |
| 79 | 87 | }  | 
                                                        
| 80 | 88 | return $return;  | 
                                                        
| 81 | 89 | }  | 
                                                        
| 82 | 90 | return $this->gamesWith;  | 
                                                        
| 83 | 91 | }  | 
                                                        
| 84 | 92 |  	public function addGroup(Group $group) { | 
                                                        
| 85 | - if (!isset($this->games[$group->getId()])) $this->games[$group->getId()] = [];  | 
                                                        |
| 93 | +		if (!isset($this->games[$group->getId()])) { | 
                                                        |
| 94 | + $this->games[$group->getId()] = [];  | 
                                                        |
| 95 | + }  | 
                                                        |
| 86 | 96 | return $this;  | 
                                                        
| 87 | 97 | }  | 
                                                        
| 88 | 98 |  	public function addGame(Game $game) { | 
                                                        
| 89 | 99 | $group = $game->getGroup();  | 
                                                        
| 90 | - if (!isset($this->games[$group->getId()])) $this->games[$group->getId()] = [];  | 
                                                        |
| 100 | +		if (!isset($this->games[$group->getId()])) { | 
                                                        |
| 101 | + $this->games[$group->getId()] = [];  | 
                                                        |
| 102 | + }  | 
                                                        |
| 91 | 103 | $this->games[$group->getId()][] = $game;  | 
                                                        
| 92 | 104 | return $this;  | 
                                                        
| 93 | 105 | }  | 
                                                        
| 94 | 106 |  	public function getGames(Group $group = null, $groupId = null) { | 
                                                        
| 95 | - if (isset($group) && isset($this->games[$group->getId()])) return $this->games[$group->getId()];  | 
                                                        |
| 96 | - if (isset($groupId) && isset($this->games[$groupId])) return $this->games[$groupId];  | 
                                                        |
| 107 | +		if (isset($group) && isset($this->games[$group->getId()])) { | 
                                                        |
| 108 | + return $this->games[$group->getId()];  | 
                                                        |
| 109 | + }  | 
                                                        |
| 110 | +		if (isset($groupId) && isset($this->games[$groupId])) { | 
                                                        |
| 111 | + return $this->games[$groupId];  | 
                                                        |
| 112 | + }  | 
                                                        |
| 97 | 113 | return $this->games;  | 
                                                        
| 98 | 114 | }  | 
                                                        
| 99 | 115 | |
@@ -105,14 +121,18 @@ discard block  | 
                                                    ||
| 105 | 121 | }  | 
                                                        
| 106 | 122 | |
| 107 | 123 |  	public function addWin(string $groupId = ''){ | 
                                                        
| 108 | -		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        |
| 124 | +		if (!isset($this->groupResults[$groupId])) { | 
                                                        |
| 125 | +			throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        |
| 126 | + }  | 
                                                        |
| 109 | 127 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->getWinPoints();  | 
                                                        
| 110 | 128 | $this->sumPoints += $this->groupResults[$groupId]['group']->getWinPoints();  | 
                                                        
| 111 | 129 | $this->groupResults[$groupId]['wins']++;  | 
                                                        
| 112 | 130 | return $this;  | 
                                                        
| 113 | 131 | }  | 
                                                        
| 114 | 132 |  	public function removeWin(string $groupId = ''){ | 
                                                        
| 115 | -		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        |
| 133 | +		if (!isset($this->groupResults[$groupId])) { | 
                                                        |
| 134 | +			throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        |
| 135 | + }  | 
                                                        |
| 116 | 136 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->getWinPoints();  | 
                                                        
| 117 | 137 | $this->sumPoints -= $this->groupResults[$groupId]['group']->getWinPoints();  | 
                                                        
| 118 | 138 | $this->groupResults[$groupId]['wins']--;  | 
                                                        
@@ -120,14 +140,18 @@ discard block  | 
                                                    ||
| 120 | 140 | }  | 
                                                        
| 121 | 141 | |
| 122 | 142 |  	public function addDraw(string $groupId = ''){ | 
                                                        
| 123 | -		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        |
| 143 | +		if (!isset($this->groupResults[$groupId])) { | 
                                                        |
| 144 | +			throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        |
| 145 | + }  | 
                                                        |
| 124 | 146 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->getDrawPoints();  | 
                                                        
| 125 | 147 | $this->sumPoints += $this->groupResults[$groupId]['group']->getDrawPoints();  | 
                                                        
| 126 | 148 | $this->groupResults[$groupId]['draws']++;  | 
                                                        
| 127 | 149 | return $this;  | 
                                                        
| 128 | 150 | }  | 
                                                        
| 129 | 151 |  	public function removeDraw(string $groupId = ''){ | 
                                                        
| 130 | -		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        |
| 152 | +		if (!isset($this->groupResults[$groupId])) { | 
                                                        |
| 153 | +			throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        |
| 154 | + }  | 
                                                        |
| 131 | 155 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->getDrawPoints();  | 
                                                        
| 132 | 156 | $this->sumPoints -= $this->groupResults[$groupId]['group']->getDrawPoints();  | 
                                                        
| 133 | 157 | $this->groupResults[$groupId]['draws']--;  | 
                                                        
@@ -135,14 +159,18 @@ discard block  | 
                                                    ||
| 135 | 159 | }  | 
                                                        
| 136 | 160 | |
| 137 | 161 |  	public function addLoss(string $groupId = ''){ | 
                                                        
| 138 | -		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        |
| 162 | +		if (!isset($this->groupResults[$groupId])) { | 
                                                        |
| 163 | +			throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        |
| 164 | + }  | 
                                                        |
| 139 | 165 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->getLostPoints();  | 
                                                        
| 140 | 166 | $this->sumPoints += $this->groupResults[$groupId]['group']->getLostPoints();  | 
                                                        
| 141 | 167 | $this->groupResults[$groupId]['losses']++;  | 
                                                        
| 142 | 168 | return $this;  | 
                                                        
| 143 | 169 | }  | 
                                                        
| 144 | 170 |  	public function removeLoss(string $groupId = ''){ | 
                                                        
| 145 | -		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        |
| 171 | +		if (!isset($this->groupResults[$groupId])) { | 
                                                        |
| 172 | +			throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        |
| 173 | + }  | 
                                                        |
| 146 | 174 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->getLostPoints();  | 
                                                        
| 147 | 175 | $this->sumPoints -= $this->groupResults[$groupId]['group']->getLostPoints();  | 
                                                        
| 148 | 176 | $this->groupResults[$groupId]['losses']--;  | 
                                                        
@@ -150,14 +178,18 @@ discard block  | 
                                                    ||
| 150 | 178 | }  | 
                                                        
| 151 | 179 | |
| 152 | 180 |  	public function addSecond(string $groupId = ''){ | 
                                                        
| 153 | -		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        |
| 181 | +		if (!isset($this->groupResults[$groupId])) { | 
                                                        |
| 182 | +			throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        |
| 183 | + }  | 
                                                        |
| 154 | 184 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->getSecondPoints();  | 
                                                        
| 155 | 185 | $this->sumPoints += $this->groupResults[$groupId]['group']->getSecondPoints();  | 
                                                        
| 156 | 186 | $this->groupResults[$groupId]['second']++;  | 
                                                        
| 157 | 187 | return $this;  | 
                                                        
| 158 | 188 | }  | 
                                                        
| 159 | 189 |  	public function removeSecond(string $groupId = ''){ | 
                                                        
| 160 | -		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        |
| 190 | +		if (!isset($this->groupResults[$groupId])) { | 
                                                        |
| 191 | +			throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        |
| 192 | + }  | 
                                                        |
| 161 | 193 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->getSecondPoints();  | 
                                                        
| 162 | 194 | $this->sumPoints -= $this->groupResults[$groupId]['group']->getSecondPoints();  | 
                                                        
| 163 | 195 | $this->groupResults[$groupId]['second']--;  | 
                                                        
@@ -165,14 +197,18 @@ discard block  | 
                                                    ||
| 165 | 197 | }  | 
                                                        
| 166 | 198 | |
| 167 | 199 |  	public function addThird(string $groupId = ''){ | 
                                                        
| 168 | -		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        |
| 200 | +		if (!isset($this->groupResults[$groupId])) { | 
                                                        |
| 201 | +			throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        |
| 202 | + }  | 
                                                        |
| 169 | 203 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->getThirdPoints();  | 
                                                        
| 170 | 204 | $this->sumPoints += $this->groupResults[$groupId]['group']->getThirdPoints();  | 
                                                        
| 171 | 205 | $this->groupResults[$groupId]['third']++;  | 
                                                        
| 172 | 206 | return $this;  | 
                                                        
| 173 | 207 | }  | 
                                                        
| 174 | 208 |  	public function removeThird(string $groupId = ''){ | 
                                                        
| 175 | -		if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        |
| 209 | +		if (!isset($this->groupResults[$groupId])) { | 
                                                        |
| 210 | +			throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); | 
                                                        |
| 211 | + }  | 
                                                        |
| 176 | 212 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->getThirdPoints();  | 
                                                        
| 177 | 213 | $this->sumPoints -= $this->groupResults[$groupId]['group']->getThirdPoints();  | 
                                                        
| 178 | 214 | $this->groupResults[$groupId]['third']--;  | 
                                                        
@@ -180,7 +216,9 @@ discard block  | 
                                                    ||
| 180 | 216 | }  | 
                                                        
| 181 | 217 | |
| 182 | 218 |  	public function sumPoints(array $groupIds = []) { | 
                                                        
| 183 | - if (count($groupIds) === 0) return $this->sumPoints;  | 
                                                        |
| 219 | +		if (count($groupIds) === 0) { | 
                                                        |
| 220 | + return $this->sumPoints;  | 
                                                        |
| 221 | + }  | 
                                                        |
| 184 | 222 | $sum = 0;  | 
                                                        
| 185 | 223 |  		foreach ($groupIds as $gid) { | 
                                                        
| 186 | 224 | $sum += $this->groupResults[$gid]['points'] ?? 0;  | 
                                                        
@@ -188,7 +226,9 @@ discard block  | 
                                                    ||
| 188 | 226 | return $sum;  | 
                                                        
| 189 | 227 | }  | 
                                                        
| 190 | 228 |  	public function sumScore(array $groupIds = []) { | 
                                                        
| 191 | - if (count($groupIds) === 0) return $this->sumScore;  | 
                                                        |
| 229 | +		if (count($groupIds) === 0) { | 
                                                        |
| 230 | + return $this->sumScore;  | 
                                                        |
| 231 | + }  | 
                                                        |
| 192 | 232 | $sum = 0;  | 
                                                        
| 193 | 233 |  		foreach ($groupIds as $gid) { | 
                                                        
| 194 | 234 | $sum += $this->groupResults[$gid]['score'] ?? 0;  | 
                                                        
@@ -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->getDrawPoints(), 'type' => 'draw'];  | 
                                                        
@@ -33,11 +33,15 @@ discard block  | 
                                                    ||
| 33 | 33 | $this->teams = $teams;  | 
                                                        
| 34 | 34 |  		foreach ($this->teams as $team) { | 
                                                        
| 35 | 35 |  			foreach ($this->teams as $team2) { | 
                                                        
| 36 | - if ($team === $team2) continue;  | 
                                                        |
| 36 | +				if ($team === $team2) { | 
                                                        |
| 37 | + continue;  | 
                                                        |
| 38 | + }  | 
                                                        |
| 37 | 39 | $team->addGameWith($team2, $group);  | 
                                                        
| 38 | 40 | }  | 
                                                        
| 39 | 41 | }  | 
                                                        
| 40 | -		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)); | 
                                                        |
| 42 | +		if (count($error) > 0) { | 
                                                        |
| 43 | +			throw new \Exception('Trying to add teams ('.count($error).') that are not instance of Team class'.PHP_EOL.print_r($error, true)); | 
                                                        |
| 44 | + }  | 
                                                        |
| 41 | 45 | }  | 
                                                        
| 42 | 46 | |
| 43 | 47 |  	public function getGroup() { | 
                                                        
@@ -56,14 +60,18 @@ discard block  | 
                                                    ||
| 56 | 60 | $team->addGame($this);  | 
                                                        
| 57 | 61 | |
| 58 | 62 |  			foreach ($this->teams as $team2) { | 
                                                        
| 59 | - if ($team === $team2) continue;  | 
                                                        |
| 63 | +				if ($team === $team2) { | 
                                                        |
| 64 | + continue;  | 
                                                        |
| 65 | + }  | 
                                                        |
| 60 | 66 |  				if ($team instanceof Team) { | 
                                                        
| 61 | 67 | $team->addGameWith($team2, $this->group);  | 
                                                        
| 62 | 68 | $team2->addGameWith($team, $this->group);  | 
                                                        
| 63 | 69 | }  | 
                                                        
| 64 | 70 | }  | 
                                                        
| 65 | 71 | }  | 
                                                        
| 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)); | 
                                                        |
| 72 | +		if (count($error) > 0) { | 
                                                        |
| 73 | +			throw new \Exception('Trying to add teams ('.count($error).') that are not instance of Team class'.PHP_EOL.print_r($error, true)); | 
                                                        |
| 74 | + }  | 
                                                        |
| 67 | 75 | return $this;  | 
                                                        
| 68 | 76 | }  | 
                                                        
| 69 | 77 |  	public function getTeams(){ | 
                                                        
@@ -83,14 +91,20 @@ discard block  | 
                                                    ||
| 83 | 91 | * )  | 
                                                        
| 84 | 92 | */  | 
                                                        
| 85 | 93 |  	public function setResults(array $results = []) { | 
                                                        
| 86 | - if (count($this->results) === 0) $this->resetResults();  | 
                                                        |
| 94 | +		if (count($this->results) === 0) { | 
                                                        |
| 95 | + $this->resetResults();  | 
                                                        |
| 96 | + }  | 
                                                        |
| 87 | 97 | arsort($results);  | 
                                                        
| 88 | 98 | $inGame = /** @scrutinizer ignore-call */ $this->group->getInGame();  | 
                                                        
| 89 | 99 | $i = 1;  | 
                                                        
| 90 | 100 |  		foreach ($results as $id => $score) { | 
                                                        
| 91 | -			if (!is_numeric($score)) throw new \TypeError('Score passed to TournamentGenerator\Game::setResults() must be of the type numeric, '.gettype($score).' given'); | 
                                                        |
| 101 | +			if (!is_numeric($score)) { | 
                                                        |
| 102 | +				throw new \TypeError('Score passed to TournamentGenerator\Game::setResults() must be of the type numeric, '.gettype($score).' given'); | 
                                                        |
| 103 | + }  | 
                                                        |
| 92 | 104 | $team = $this->getTeam($id);  | 
                                                        
| 93 | -			if (!$team instanceof Team) throw new \Exception('Couldn\'t find team with id of "'.$id.'"'); | 
                                                        |
| 105 | +			if (!$team instanceof Team) { | 
                                                        |
| 106 | +				throw new \Exception('Couldn\'t find team with id of "'.$id.'"'); | 
                                                        |
| 107 | + }  | 
                                                        |
| 94 | 108 | $this->results[$team->getId()] = ['score' => $score];  | 
                                                        
| 95 | 109 | $team->addScore($score);  | 
                                                        
| 96 | 110 |  			switch ($inGame) { | 
                                                        
@@ -114,13 +128,11 @@ discard block  | 
                                                    ||
| 114 | 128 | $this->drawIds[] = $team->getId();  | 
                                                        
| 115 | 129 | $team->addDraw($this->group->getId());  | 
                                                        
| 116 | 130 | $this->results[$team->getId()] += ['points' => $this->group->getDrawPoints(), 'type' => 'draw'];  | 
                                                        
| 117 | - }  | 
                                                        |
| 118 | -		elseif ($i === 1) { | 
                                                        |
| 131 | +		} elseif ($i === 1) { | 
                                                        |
| 119 | 132 | $this->winId = $team->getId();  | 
                                                        
| 120 | 133 | $team->addWin($this->group->getId());  | 
                                                        
| 121 | 134 | $this->results[$team->getId()] += ['points' => $this->group->getWinPoints(), 'type' => 'win'];  | 
                                                        
| 122 | - }  | 
                                                        |
| 123 | -		else { | 
                                                        |
| 135 | +		} else { | 
                                                        |
| 124 | 136 | $this->lossId = $team->getId();  | 
                                                        
| 125 | 137 | $team->addLoss($this->group->getId());  | 
                                                        
| 126 | 138 | $this->results[$team->getId()] += ['points' => $this->group->getLostPoints(), 'type' => 'loss'];  | 
                                                        
@@ -220,7 +232,9 @@ discard block  | 
                                                    ||
| 220 | 232 | }  | 
                                                        
| 221 | 233 | |
| 222 | 234 |  	public function isPlayed() { | 
                                                        
| 223 | - if (count($this->results) > 0) return true;  | 
                                                        |
| 235 | +		if (count($this->results) > 0) { | 
                                                        |
| 236 | + return true;  | 
                                                        |
| 237 | + }  | 
                                                        |
| 224 | 238 | return false;  | 
                                                        
| 225 | 239 | }  | 
                                                        
| 226 | 240 | }  | 
                                                        
@@ -38,12 +38,20 @@ discard block  | 
                                                    ||
| 38 | 38 | }  | 
                                                        
| 39 | 39 | |
| 40 | 40 |  	public function progress(bool $blank = false) { | 
                                                        
| 41 | - if ($this->progressed) return $this;  | 
                                                        |
| 42 | - if ($blank) $teams = $this->from->isPlayed() ? $this->from->sortTeams(null, $this->filters) : $this->from->simulate($this->filters);  | 
                                                        |
| 43 | - else $teams = $this->from->sortTeams(null, $this->filters);  | 
                                                        |
| 41 | +		if ($this->progressed) { | 
                                                        |
| 42 | + return $this;  | 
                                                        |
| 43 | + }  | 
                                                        |
| 44 | +		if ($blank) { | 
                                                        |
| 45 | + $teams = $this->from->isPlayed() ? $this->from->sortTeams(null, $this->filters) : $this->from->simulate($this->filters);  | 
                                                        |
| 46 | +		} else { | 
                                                        |
| 47 | + $teams = $this->from->sortTeams(null, $this->filters);  | 
                                                        |
| 48 | + }  | 
                                                        |
| 44 | 49 | |
| 45 | - if (count($this->filters) === 0 || $this->len !== null || $this->start !== 0) $next = array_splice($teams, $this->start, ($this->len === null ? count($teams) : $this->len));  | 
                                                        |
| 46 | - else $next = $teams;  | 
                                                        |
| 50 | +		if (count($this->filters) === 0 || $this->len !== null || $this->start !== 0) { | 
                                                        |
| 51 | + $next = array_splice($teams, $this->start, ($this->len === null ? count($teams) : $this->len));  | 
                                                        |
| 52 | +		} else { | 
                                                        |
| 53 | + $next = $teams;  | 
                                                        |
| 54 | + }  | 
                                                        |
| 47 | 55 | |
| 48 | 56 | $i = 1;  | 
                                                        
| 49 | 57 | |
@@ -51,12 +59,15 @@ discard block  | 
                                                    ||
| 51 | 59 |  			if ($blank) { | 
                                                        
| 52 | 60 | $this->to->addTeam(new BlankTeam($this.' - '.$i, $team, $this->from, $this));  | 
                                                        
| 53 | 61 | $i++;  | 
                                                        
| 62 | +			} else { | 
                                                        |
| 63 | + $team->addPoints($this->from->getProgressPoints());  | 
                                                        |
| 54 | 64 | }  | 
                                                        
| 55 | - else $team->addPoints($this->from->getProgressPoints());  | 
                                                        |
| 56 | 65 | }  | 
                                                        
| 57 | 66 | |
| 58 | 67 | $this->from->addProgressed($next);  | 
                                                        
| 59 | - if (!$blank) $this->to->addTeam($next);  | 
                                                        |
| 68 | +		if (!$blank) { | 
                                                        |
| 69 | + $this->to->addTeam($next);  | 
                                                        |
| 70 | + }  | 
                                                        |
| 60 | 71 | $this->progressed = true;  | 
                                                        
| 61 | 72 | return $this;  | 
                                                        
| 62 | 73 | }  |