@@ -24,33 +24,33 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | - * Sets the name of the object |
|
| 28 | - * |
|
| 29 | - * @param string $name Name of the object |
|
| 30 | - * |
|
| 31 | - * @return self |
|
| 32 | - */ |
|
| 27 | + * Sets the name of the object |
|
| 28 | + * |
|
| 29 | + * @param string $name Name of the object |
|
| 30 | + * |
|
| 31 | + * @return self |
|
| 32 | + */ |
|
| 33 | 33 | public function setName(string $name) { |
| 34 | 34 | $this->name = $name; |
| 35 | 35 | return $this; |
| 36 | 36 | } |
| 37 | 37 | /** |
| 38 | - * Gets the name of the object |
|
| 39 | - * |
|
| 40 | - * @return string Name of the object |
|
| 41 | - */ |
|
| 38 | + * Gets the name of the object |
|
| 39 | + * |
|
| 40 | + * @return string Name of the object |
|
| 41 | + */ |
|
| 42 | 42 | public function getName() { |
| 43 | 43 | return $this->name; |
| 44 | 44 | } |
| 45 | 45 | /** |
| 46 | - * Sets the unique identifier of the object |
|
| 47 | - * |
|
| 48 | - * @param string|int $id Unique identifier of the object |
|
| 49 | - * |
|
| 50 | - * @throws \InvalidArgumentException if the provided argument is not of type 'string' or 'int' |
|
| 51 | - * |
|
| 52 | - * @return self |
|
| 53 | - */ |
|
| 46 | + * Sets the unique identifier of the object |
|
| 47 | + * |
|
| 48 | + * @param string|int $id Unique identifier of the object |
|
| 49 | + * |
|
| 50 | + * @throws \InvalidArgumentException if the provided argument is not of type 'string' or 'int' |
|
| 51 | + * |
|
| 52 | + * @return self |
|
| 53 | + */ |
|
| 54 | 54 | public function setId($id) { |
| 55 | 55 | if (!is_string($id) && !is_int($id)) { |
| 56 | 56 | $this->id = uniqid(); |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | return $this; |
| 61 | 61 | } |
| 62 | 62 | /** |
| 63 | - * Gets the unique identifier of the object |
|
| 64 | - * |
|
| 65 | - * @return string Unique identifier of the object |
|
| 66 | - */ |
|
| 63 | + * Gets the unique identifier of the object |
|
| 64 | + * |
|
| 65 | + * @return string Unique identifier of the object |
|
| 66 | + */ |
|
| 67 | 67 | public function getId() { |
| 68 | 68 | return $this->id; |
| 69 | 69 | } |
@@ -14,9 +14,9 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | - * @var string $name The name of the team |
|
| 18 | - * @var string|int $id The unique identifier of the team |
|
| 19 | - */ |
|
| 17 | + * @var string $name The name of the team |
|
| 18 | + * @var string|int $id The unique identifier of the team |
|
| 19 | + */ |
|
| 20 | 20 | |
| 21 | 21 | /** @var array $games A list of games played by this team */ |
| 22 | 22 | protected $games = []; |
@@ -31,57 +31,57 @@ discard block |
||
| 31 | 31 | protected $sumScore = 0; |
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | - * @var array $groupResults Associative array of results in each group |
|
| 35 | - * |
|
| 36 | - * array ( |
|
| 37 | - * * groupId => array ( |
|
| 38 | - * * * "group" => Group, # GROUP OBJECT |
|
| 39 | - * * * "points" => int 0, # NUMBER OF POINTS AQUIRED |
|
| 40 | - * * * "score" => int 0, # SUM OF SCORE AQUIRED |
|
| 41 | - * * * "wins" => int 0, # NUMBER OF WINS |
|
| 42 | - * * * "draws" => int 0, # NUMBER OF DRAWS |
|
| 43 | - * * * "losses" => int 0, # NUMBER OF LOSSES |
|
| 44 | - * * * "second" => int 0, # NUMBER OF TIMES BEING SECOND (ONLY FOR INGAME OPTION OF 3 OR 4) |
|
| 45 | - * * * "third" => int 0 # NUMBER OF TIMES BEING THIRD (ONLY FOR INGAME OPTION OF 4) |
|
| 46 | - * * ) |
|
| 47 | - *) |
|
| 48 | - */ |
|
| 34 | + * @var array $groupResults Associative array of results in each group |
|
| 35 | + * |
|
| 36 | + * array ( |
|
| 37 | + * * groupId => array ( |
|
| 38 | + * * * "group" => Group, # GROUP OBJECT |
|
| 39 | + * * * "points" => int 0, # NUMBER OF POINTS AQUIRED |
|
| 40 | + * * * "score" => int 0, # SUM OF SCORE AQUIRED |
|
| 41 | + * * * "wins" => int 0, # NUMBER OF WINS |
|
| 42 | + * * * "draws" => int 0, # NUMBER OF DRAWS |
|
| 43 | + * * * "losses" => int 0, # NUMBER OF LOSSES |
|
| 44 | + * * * "second" => int 0, # NUMBER OF TIMES BEING SECOND (ONLY FOR INGAME OPTION OF 3 OR 4) |
|
| 45 | + * * * "third" => int 0 # NUMBER OF TIMES BEING THIRD (ONLY FOR INGAME OPTION OF 4) |
|
| 46 | + * * ) |
|
| 47 | + *) |
|
| 48 | + */ |
|
| 49 | 49 | public $groupResults = []; |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | - * Initiates a team class |
|
| 53 | - * |
|
| 54 | - * @param string $name Name of the team |
|
| 55 | - * @param string|int $id Unique identifier of the team |
|
| 56 | - * |
|
| 57 | - * @throws \InvalidArgumentException if the provided argument id is not of type 'null' or 'string' or 'int' |
|
| 58 | - */ |
|
| 52 | + * Initiates a team class |
|
| 53 | + * |
|
| 54 | + * @param string $name Name of the team |
|
| 55 | + * @param string|int $id Unique identifier of the team |
|
| 56 | + * |
|
| 57 | + * @throws \InvalidArgumentException if the provided argument id is not of type 'null' or 'string' or 'int' |
|
| 58 | + */ |
|
| 59 | 59 | function __construct(string $name = 'team', $id = null) { |
| 60 | 60 | $this->setName($name); |
| 61 | 61 | $this->setId(isset($id) ? $id : uniqid()); |
| 62 | 62 | } |
| 63 | 63 | /** |
| 64 | - * Gets team statistics from the given group without the group object |
|
| 65 | - * |
|
| 66 | - * @param string|int $groupId Unique identifier of the group to get its results |
|
| 67 | - * |
|
| 68 | - * @throws \Exception if the group with given groupId doesn't exist |
|
| 69 | - * |
|
| 70 | - * @return array All the statistics including points, score, wins, draws, losses, times being second, times being third |
|
| 71 | - */ |
|
| 64 | + * Gets team statistics from the given group without the group object |
|
| 65 | + * |
|
| 66 | + * @param string|int $groupId Unique identifier of the group to get its results |
|
| 67 | + * |
|
| 68 | + * @throws \Exception if the group with given groupId doesn't exist |
|
| 69 | + * |
|
| 70 | + * @return array All the statistics including points, score, wins, draws, losses, times being second, times being third |
|
| 71 | + */ |
|
| 72 | 72 | public function getGamesInfo($groupId) { |
| 73 | 73 | return array_filter($this->getGroupResults($groupId), function($k) { return $k !== 'group'; }, ARRAY_FILTER_USE_KEY); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | - * Creates a new data-array to store statistics for a new group |
|
| 78 | - * |
|
| 79 | - * Resets the statistics if the group was already added |
|
| 80 | - * |
|
| 81 | - * @param Group $group A group object to add its results |
|
| 82 | - * |
|
| 83 | - * @return self |
|
| 84 | - */ |
|
| 77 | + * Creates a new data-array to store statistics for a new group |
|
| 78 | + * |
|
| 79 | + * Resets the statistics if the group was already added |
|
| 80 | + * |
|
| 81 | + * @param Group $group A group object to add its results |
|
| 82 | + * |
|
| 83 | + * @return self |
|
| 84 | + */ |
|
| 85 | 85 | public function addGroupResults(Group $group) { |
| 86 | 86 | $this->groupResults[$group->getId()] = [ |
| 87 | 87 | 'group' => $group, |
@@ -96,14 +96,14 @@ discard block |
||
| 96 | 96 | return $this; |
| 97 | 97 | } |
| 98 | 98 | /** |
| 99 | - * Gets team statistics from the given group |
|
| 100 | - * |
|
| 101 | - * @param string|int|null $groupId Unique identifier of the group to get its results |
|
| 102 | - * |
|
| 103 | - * @throws \Exception if the group with given groupId doesn't exist |
|
| 104 | - * |
|
| 105 | - * @return array All the statistics including points, score, wins, draws, losses, times being second, times being third if the group id is set or all the statistics |
|
| 106 | - */ |
|
| 99 | + * Gets team statistics from the given group |
|
| 100 | + * |
|
| 101 | + * @param string|int|null $groupId Unique identifier of the group to get its results |
|
| 102 | + * |
|
| 103 | + * @throws \Exception if the group with given groupId doesn't exist |
|
| 104 | + * |
|
| 105 | + * @return array All the statistics including points, score, wins, draws, losses, times being second, times being third if the group id is set or all the statistics |
|
| 106 | + */ |
|
| 107 | 107 | public function getGroupResults($groupId = null) { |
| 108 | 108 | if (isset($groupId)) { |
| 109 | 109 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Trying to get unexisting group results ('.$groupId.')'); |
@@ -113,26 +113,26 @@ discard block |
||
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
| 116 | - * Adds a record of a game with another team in a group |
|
| 117 | - * |
|
| 118 | - * @param Team $team A team that played with this team |
|
| 119 | - * @param Group $group A group that the teams were playing in |
|
| 120 | - * |
|
| 121 | - * @return self |
|
| 122 | - */ |
|
| 116 | + * Adds a record of a game with another team in a group |
|
| 117 | + * |
|
| 118 | + * @param Team $team A team that played with this team |
|
| 119 | + * @param Group $group A group that the teams were playing in |
|
| 120 | + * |
|
| 121 | + * @return self |
|
| 122 | + */ |
|
| 123 | 123 | public function addGameWith(Team $team, Group $group) { |
| 124 | 124 | if (!isset($this->gamesWith[$group->getId()][$team->getId()])) $this->gamesWith[$group->getId()][$team->getId()] = 0; |
| 125 | 125 | $this->gamesWith[$group->getId()][$team->getId()]++; |
| 126 | 126 | return $this; |
| 127 | 127 | } |
| 128 | 128 | /** |
| 129 | - * Gets a record of a game with another team or teams |
|
| 130 | - * |
|
| 131 | - * @param Team|null $team A team to get the games with |
|
| 132 | - * @param Group|null $group A group from where to get the games |
|
| 133 | - * |
|
| 134 | - * @return array|int The number of games played with a team in a group if both arguments are given, array of all games with all teams from a group if only group is given, array of games with team from all groups if only a team argument is given or all games with all teams from all groups if no argument is given |
|
| 135 | - */ |
|
| 129 | + * Gets a record of a game with another team or teams |
|
| 130 | + * |
|
| 131 | + * @param Team|null $team A team to get the games with |
|
| 132 | + * @param Group|null $group A group from where to get the games |
|
| 133 | + * |
|
| 134 | + * @return array|int The number of games played with a team in a group if both arguments are given, array of all games with all teams from a group if only group is given, array of games with team from all groups if only a team argument is given or all games with all teams from all groups if no argument is given |
|
| 135 | + */ |
|
| 136 | 136 | public function getGameWith(Team $team = null, Group $group = null) { |
| 137 | 137 | if (isset($group)) { |
| 138 | 138 | if (isset($team)) return $this->gamesWith[$group->getId()][$team->getId()]; |
@@ -151,23 +151,23 @@ discard block |
||
| 151 | 151 | return $this->gamesWith; |
| 152 | 152 | } |
| 153 | 153 | /** |
| 154 | - * Adds a group to a team and creates an array for all games to be played |
|
| 155 | - * |
|
| 156 | - * @param Group $group A group to add |
|
| 157 | - * |
|
| 158 | - * @return self |
|
| 159 | - */ |
|
| 154 | + * Adds a group to a team and creates an array for all games to be played |
|
| 155 | + * |
|
| 156 | + * @param Group $group A group to add |
|
| 157 | + * |
|
| 158 | + * @return self |
|
| 159 | + */ |
|
| 160 | 160 | public function addGroup(Group $group) { |
| 161 | 161 | if (!isset($this->games[$group->getId()])) $this->games[$group->getId()] = []; |
| 162 | 162 | return $this; |
| 163 | 163 | } |
| 164 | 164 | /** |
| 165 | - * Adds a game to this team |
|
| 166 | - * |
|
| 167 | - * @param Game $game A game to add |
|
| 168 | - * |
|
| 169 | - * @return self |
|
| 170 | - */ |
|
| 165 | + * Adds a game to this team |
|
| 166 | + * |
|
| 167 | + * @param Game $game A game to add |
|
| 168 | + * |
|
| 169 | + * @return self |
|
| 170 | + */ |
|
| 171 | 171 | public function addGame(Game $game) { |
| 172 | 172 | $group = $game->getGroup(); |
| 173 | 173 | if (!isset($this->games[$group->getId()])) $this->games[$group->getId()] = []; |
@@ -175,13 +175,13 @@ discard block |
||
| 175 | 175 | return $this; |
| 176 | 176 | } |
| 177 | 177 | /** |
| 178 | - * Gets all game from given group |
|
| 179 | - * |
|
| 180 | - * @param Group|null $group A group to get its game from |
|
| 181 | - * @param string|int|null $groupId An id of group to get its game from |
|
| 182 | - * |
|
| 183 | - * @return array Games from a group or all games if both arguments are null |
|
| 184 | - */ |
|
| 178 | + * Gets all game from given group |
|
| 179 | + * |
|
| 180 | + * @param Group|null $group A group to get its game from |
|
| 181 | + * @param string|int|null $groupId An id of group to get its game from |
|
| 182 | + * |
|
| 183 | + * @return array Games from a group or all games if both arguments are null |
|
| 184 | + */ |
|
| 185 | 185 | public function getGames(Group $group = null, $groupId = null) { |
| 186 | 186 | if (isset($group) && isset($this->games[$group->getId()])) return $this->games[$group->getId()]; |
| 187 | 187 | if (isset($groupId) && isset($this->games[$groupId])) return $this->games[$groupId]; |
@@ -189,33 +189,33 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | - * Gets all points that the team has acquired through the tournament |
|
| 193 | - * |
|
| 194 | - * @return int Sum of the points acquired |
|
| 195 | - */ |
|
| 192 | + * Gets all points that the team has acquired through the tournament |
|
| 193 | + * |
|
| 194 | + * @return int Sum of the points acquired |
|
| 195 | + */ |
|
| 196 | 196 | public function getSumPoints() { |
| 197 | 197 | return $this->sumPoints; |
| 198 | 198 | } |
| 199 | 199 | /** |
| 200 | - * Gets all score that the team has acquired through the tournament |
|
| 201 | - * |
|
| 202 | - * @return int Sum of the score acquired |
|
| 203 | - */ |
|
| 200 | + * Gets all score that the team has acquired through the tournament |
|
| 201 | + * |
|
| 202 | + * @return int Sum of the score acquired |
|
| 203 | + */ |
|
| 204 | 204 | public function getSumScore() { |
| 205 | 205 | return $this->sumScore; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
| 209 | - * Adds a win points to the team |
|
| 210 | - * |
|
| 211 | - * @param string|int|null $groupId An id of group to add the results from |
|
| 212 | - * |
|
| 213 | - * @throws \Exception if the group results have not been added |
|
| 214 | - * |
|
| 215 | - * @uses Group::getWinPoints() to retrieve the points to add |
|
| 216 | - * |
|
| 217 | - * @return self |
|
| 218 | - */ |
|
| 209 | + * Adds a win points to the team |
|
| 210 | + * |
|
| 211 | + * @param string|int|null $groupId An id of group to add the results from |
|
| 212 | + * |
|
| 213 | + * @throws \Exception if the group results have not been added |
|
| 214 | + * |
|
| 215 | + * @uses Group::getWinPoints() to retrieve the points to add |
|
| 216 | + * |
|
| 217 | + * @return self |
|
| 218 | + */ |
|
| 219 | 219 | public function addWin(string $groupId = ''){ |
| 220 | 220 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
| 221 | 221 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->getWinPoints(); |
@@ -224,16 +224,16 @@ discard block |
||
| 224 | 224 | return $this; |
| 225 | 225 | } |
| 226 | 226 | /** |
| 227 | - * Remove win points to the team |
|
| 228 | - * |
|
| 229 | - * @param string|int|null $groupId An id of group to add the results from |
|
| 230 | - * |
|
| 231 | - * @throws \Exception if the group results have not been added |
|
| 232 | - * |
|
| 233 | - * @uses Group::getWinPoints() to retrieve the points to add |
|
| 234 | - * |
|
| 235 | - * @return self |
|
| 236 | - */ |
|
| 227 | + * Remove win points to the team |
|
| 228 | + * |
|
| 229 | + * @param string|int|null $groupId An id of group to add the results from |
|
| 230 | + * |
|
| 231 | + * @throws \Exception if the group results have not been added |
|
| 232 | + * |
|
| 233 | + * @uses Group::getWinPoints() to retrieve the points to add |
|
| 234 | + * |
|
| 235 | + * @return self |
|
| 236 | + */ |
|
| 237 | 237 | public function removeWin(string $groupId = ''){ |
| 238 | 238 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
| 239 | 239 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->getWinPoints(); |
@@ -243,16 +243,16 @@ discard block |
||
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |
| 246 | - * Adds a draw points to the team |
|
| 247 | - * |
|
| 248 | - * @param string|int|null $groupId An id of group to add the results from |
|
| 249 | - * |
|
| 250 | - * @throws \Exception if the group results have not been added |
|
| 251 | - * |
|
| 252 | - * @uses Group::getDrawPoints() to retrieve the points to add |
|
| 253 | - * |
|
| 254 | - * @return self |
|
| 255 | - */ |
|
| 246 | + * Adds a draw points to the team |
|
| 247 | + * |
|
| 248 | + * @param string|int|null $groupId An id of group to add the results from |
|
| 249 | + * |
|
| 250 | + * @throws \Exception if the group results have not been added |
|
| 251 | + * |
|
| 252 | + * @uses Group::getDrawPoints() to retrieve the points to add |
|
| 253 | + * |
|
| 254 | + * @return self |
|
| 255 | + */ |
|
| 256 | 256 | public function addDraw(string $groupId = ''){ |
| 257 | 257 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
| 258 | 258 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->getDrawPoints(); |
@@ -261,16 +261,16 @@ discard block |
||
| 261 | 261 | return $this; |
| 262 | 262 | } |
| 263 | 263 | /** |
| 264 | - * Remove draw points to the team |
|
| 265 | - * |
|
| 266 | - * @param string|int|null $groupId An id of group to add the results from |
|
| 267 | - * |
|
| 268 | - * @throws \Exception if the group results have not been added |
|
| 269 | - * |
|
| 270 | - * @uses Group::getDrawPoints() to retrieve the points to add |
|
| 271 | - * |
|
| 272 | - * @return self |
|
| 273 | - */ |
|
| 264 | + * Remove draw points to the team |
|
| 265 | + * |
|
| 266 | + * @param string|int|null $groupId An id of group to add the results from |
|
| 267 | + * |
|
| 268 | + * @throws \Exception if the group results have not been added |
|
| 269 | + * |
|
| 270 | + * @uses Group::getDrawPoints() to retrieve the points to add |
|
| 271 | + * |
|
| 272 | + * @return self |
|
| 273 | + */ |
|
| 274 | 274 | public function removeDraw(string $groupId = ''){ |
| 275 | 275 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
| 276 | 276 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->getDrawPoints(); |
@@ -280,16 +280,16 @@ discard block |
||
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | /** |
| 283 | - * Adds a loss points to the team |
|
| 284 | - * |
|
| 285 | - * @param string|int|null $groupId An id of group to add the results from |
|
| 286 | - * |
|
| 287 | - * @throws \Exception if the group results have not been added |
|
| 288 | - * |
|
| 289 | - * @uses Group::getLossPoints() to retrieve the points to add |
|
| 290 | - * |
|
| 291 | - * @return self |
|
| 292 | - */ |
|
| 283 | + * Adds a loss points to the team |
|
| 284 | + * |
|
| 285 | + * @param string|int|null $groupId An id of group to add the results from |
|
| 286 | + * |
|
| 287 | + * @throws \Exception if the group results have not been added |
|
| 288 | + * |
|
| 289 | + * @uses Group::getLossPoints() to retrieve the points to add |
|
| 290 | + * |
|
| 291 | + * @return self |
|
| 292 | + */ |
|
| 293 | 293 | public function addLoss(string $groupId = ''){ |
| 294 | 294 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
| 295 | 295 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->getLostPoints(); |
@@ -298,16 +298,16 @@ discard block |
||
| 298 | 298 | return $this; |
| 299 | 299 | } |
| 300 | 300 | /** |
| 301 | - * Remove loss points to the team |
|
| 302 | - * |
|
| 303 | - * @param string|int|null $groupId An id of group to add the results from |
|
| 304 | - * |
|
| 305 | - * @throws \Exception if the group results have not been added |
|
| 306 | - * |
|
| 307 | - * @uses Group::getLossPoints() to retrieve the points to add |
|
| 308 | - * |
|
| 309 | - * @return self |
|
| 310 | - */ |
|
| 301 | + * Remove loss points to the team |
|
| 302 | + * |
|
| 303 | + * @param string|int|null $groupId An id of group to add the results from |
|
| 304 | + * |
|
| 305 | + * @throws \Exception if the group results have not been added |
|
| 306 | + * |
|
| 307 | + * @uses Group::getLossPoints() to retrieve the points to add |
|
| 308 | + * |
|
| 309 | + * @return self |
|
| 310 | + */ |
|
| 311 | 311 | public function removeLoss(string $groupId = ''){ |
| 312 | 312 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
| 313 | 313 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->getLostPoints(); |
@@ -317,16 +317,16 @@ discard block |
||
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | /** |
| 320 | - * Adds points for being second to the team |
|
| 321 | - * |
|
| 322 | - * @param string|int|null $groupId An id of group to add the results from |
|
| 323 | - * |
|
| 324 | - * @throws \Exception if the group results have not been added |
|
| 325 | - * |
|
| 326 | - * @uses Group::getSecondPoints() to retrieve the points to add |
|
| 327 | - * |
|
| 328 | - * @return self |
|
| 329 | - */ |
|
| 320 | + * Adds points for being second to the team |
|
| 321 | + * |
|
| 322 | + * @param string|int|null $groupId An id of group to add the results from |
|
| 323 | + * |
|
| 324 | + * @throws \Exception if the group results have not been added |
|
| 325 | + * |
|
| 326 | + * @uses Group::getSecondPoints() to retrieve the points to add |
|
| 327 | + * |
|
| 328 | + * @return self |
|
| 329 | + */ |
|
| 330 | 330 | public function addSecond(string $groupId = ''){ |
| 331 | 331 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
| 332 | 332 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->getSecondPoints(); |
@@ -335,16 +335,16 @@ discard block |
||
| 335 | 335 | return $this; |
| 336 | 336 | } |
| 337 | 337 | /** |
| 338 | - * Remove points for being second to the team |
|
| 339 | - * |
|
| 340 | - * @param string|int|null $groupId An id of group to add the results from |
|
| 341 | - * |
|
| 342 | - * @throws \Exception if the group results have not been added |
|
| 343 | - * |
|
| 344 | - * @uses Group::getSecondPoints() to retrieve the points to add |
|
| 345 | - * |
|
| 346 | - * @return self |
|
| 347 | - */ |
|
| 338 | + * Remove points for being second to the team |
|
| 339 | + * |
|
| 340 | + * @param string|int|null $groupId An id of group to add the results from |
|
| 341 | + * |
|
| 342 | + * @throws \Exception if the group results have not been added |
|
| 343 | + * |
|
| 344 | + * @uses Group::getSecondPoints() to retrieve the points to add |
|
| 345 | + * |
|
| 346 | + * @return self |
|
| 347 | + */ |
|
| 348 | 348 | public function removeSecond(string $groupId = ''){ |
| 349 | 349 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
| 350 | 350 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->getSecondPoints(); |
@@ -354,16 +354,16 @@ discard block |
||
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | /** |
| 357 | - * Adds points for being third to the team |
|
| 358 | - * |
|
| 359 | - * @param string|int|null $groupId An id of group to add the results from |
|
| 360 | - * |
|
| 361 | - * @throws \Exception if the group results have not been added |
|
| 362 | - * |
|
| 363 | - * @uses Group::getThirdPoints() to retrieve the points to add |
|
| 364 | - * |
|
| 365 | - * @return self |
|
| 366 | - */ |
|
| 357 | + * Adds points for being third to the team |
|
| 358 | + * |
|
| 359 | + * @param string|int|null $groupId An id of group to add the results from |
|
| 360 | + * |
|
| 361 | + * @throws \Exception if the group results have not been added |
|
| 362 | + * |
|
| 363 | + * @uses Group::getThirdPoints() to retrieve the points to add |
|
| 364 | + * |
|
| 365 | + * @return self |
|
| 366 | + */ |
|
| 367 | 367 | public function addThird(string $groupId = ''){ |
| 368 | 368 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
| 369 | 369 | $this->groupResults[$groupId]['points'] += $this->groupResults[$groupId]['group']->getThirdPoints(); |
@@ -372,16 +372,16 @@ discard block |
||
| 372 | 372 | return $this; |
| 373 | 373 | } |
| 374 | 374 | /** |
| 375 | - * Remove points for being third to the team |
|
| 376 | - * |
|
| 377 | - * @param string|int|null $groupId An id of group to add the results from |
|
| 378 | - * |
|
| 379 | - * @throws \Exception if the group results have not been added |
|
| 380 | - * |
|
| 381 | - * @uses Group::getThirdPoints() to retrieve the points to add |
|
| 382 | - * |
|
| 383 | - * @return self |
|
| 384 | - */ |
|
| 375 | + * Remove points for being third to the team |
|
| 376 | + * |
|
| 377 | + * @param string|int|null $groupId An id of group to add the results from |
|
| 378 | + * |
|
| 379 | + * @throws \Exception if the group results have not been added |
|
| 380 | + * |
|
| 381 | + * @uses Group::getThirdPoints() to retrieve the points to add |
|
| 382 | + * |
|
| 383 | + * @return self |
|
| 384 | + */ |
|
| 385 | 385 | public function removeThird(string $groupId = ''){ |
| 386 | 386 | if (!isset($this->groupResults[$groupId])) throw new \Exception('Group '.$groupId.' is not set for this team ('.$this->name.')'); |
| 387 | 387 | $this->groupResults[$groupId]['points'] -= $this->groupResults[$groupId]['group']->getThirdPoints(); |
@@ -391,12 +391,12 @@ discard block |
||
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | /** |
| 394 | - * Calculate all the points acquired from given group ids |
|
| 395 | - * |
|
| 396 | - * @param array $groupIds Array of group ids |
|
| 397 | - * |
|
| 398 | - * @return int Sum of the points or sum of all points if argument is empty |
|
| 399 | - */ |
|
| 394 | + * Calculate all the points acquired from given group ids |
|
| 395 | + * |
|
| 396 | + * @param array $groupIds Array of group ids |
|
| 397 | + * |
|
| 398 | + * @return int Sum of the points or sum of all points if argument is empty |
|
| 399 | + */ |
|
| 400 | 400 | public function sumPoints(array $groupIds = []) { |
| 401 | 401 | if (count($groupIds) === 0) return $this->sumPoints; |
| 402 | 402 | $sum = 0; |
@@ -406,12 +406,12 @@ discard block |
||
| 406 | 406 | return $sum; |
| 407 | 407 | } |
| 408 | 408 | /** |
| 409 | - * Calculate all score acquired from given group ids |
|
| 410 | - * |
|
| 411 | - * @param array $groupIds Array of group ids |
|
| 412 | - * |
|
| 413 | - * @return int Sum of score or sum of all score if argument is empty |
|
| 414 | - */ |
|
| 409 | + * Calculate all score acquired from given group ids |
|
| 410 | + * |
|
| 411 | + * @param array $groupIds Array of group ids |
|
| 412 | + * |
|
| 413 | + * @return int Sum of score or sum of all score if argument is empty |
|
| 414 | + */ |
|
| 415 | 415 | public function sumScore(array $groupIds = []) { |
| 416 | 416 | if (count($groupIds) === 0) return $this->sumScore; |
| 417 | 417 | $sum = 0; |
@@ -422,45 +422,45 @@ discard block |
||
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | /** |
| 425 | - * Adds score to the total sum |
|
| 426 | - * |
|
| 427 | - * @param int $score Score to add |
|
| 428 | - * |
|
| 429 | - * @return self |
|
| 430 | - */ |
|
| 425 | + * Adds score to the total sum |
|
| 426 | + * |
|
| 427 | + * @param int $score Score to add |
|
| 428 | + * |
|
| 429 | + * @return self |
|
| 430 | + */ |
|
| 431 | 431 | public function addScore(int $score) { |
| 432 | 432 | $this->sumScore += $score; |
| 433 | 433 | return $this; |
| 434 | 434 | } |
| 435 | 435 | /** |
| 436 | - * Removes score to the total sum |
|
| 437 | - * |
|
| 438 | - * @param int $score Score to add |
|
| 439 | - * |
|
| 440 | - * @return self |
|
| 441 | - */ |
|
| 436 | + * Removes score to the total sum |
|
| 437 | + * |
|
| 438 | + * @param int $score Score to add |
|
| 439 | + * |
|
| 440 | + * @return self |
|
| 441 | + */ |
|
| 442 | 442 | public function removeScore(int $score) { |
| 443 | 443 | $this->sumScore -= $score; |
| 444 | 444 | return $this; |
| 445 | 445 | } |
| 446 | 446 | /** |
| 447 | - * Adds points to the total sum |
|
| 448 | - * |
|
| 449 | - * @param int $points Points to add |
|
| 450 | - * |
|
| 451 | - * @return self |
|
| 452 | - */ |
|
| 447 | + * Adds points to the total sum |
|
| 448 | + * |
|
| 449 | + * @param int $points Points to add |
|
| 450 | + * |
|
| 451 | + * @return self |
|
| 452 | + */ |
|
| 453 | 453 | public function addPoints(int $points) { |
| 454 | 454 | $this->sumPoints += $points; |
| 455 | 455 | return $this; |
| 456 | 456 | } |
| 457 | 457 | /** |
| 458 | - * Removes points to the total sum |
|
| 459 | - * |
|
| 460 | - * @param int $points Points to remove |
|
| 461 | - * |
|
| 462 | - * @return self |
|
| 463 | - */ |
|
| 458 | + * Removes points to the total sum |
|
| 459 | + * |
|
| 460 | + * @param int $points Points to remove |
|
| 461 | + * |
|
| 462 | + * @return self |
|
| 463 | + */ |
|
| 464 | 464 | public function removePoints(int $points) { |
| 465 | 465 | $this->sumPoints -= $points; |
| 466 | 466 | return $this; |