| @@ 139-149 (lines=11) @@ | ||
| 136 | * |
|
| 137 | * @return bool|null True if both the player was added to the team AND the team member count was incremented |
|
| 138 | */ |
|
| 139 | public function addMember($id) |
|
| 140 | { |
|
| 141 | $player = Player::get($id); |
|
| 142 | ||
| 143 | if (!$player->isTeamless()) { |
|
| 144 | throw new Exception("The player already belongs in a team"); |
|
| 145 | } |
|
| 146 | ||
| 147 | $player->setTeam($this->getId()); |
|
| 148 | $this->update('members', ++$this->members); |
|
| 149 | } |
|
| 150 | ||
| 151 | /** |
|
| 152 | * Increase or decrease the ELO of the team |
|
| @@ 446-456 (lines=11) @@ | ||
| 443 | * @param int $id The id of the player to remove |
|
| 444 | * @return void |
|
| 445 | */ |
|
| 446 | public function removeMember($id) |
|
| 447 | { |
|
| 448 | if (!$this->isMember($id)) { |
|
| 449 | throw new Exception("The player is not a member of that team"); |
|
| 450 | } |
|
| 451 | ||
| 452 | $player = Player::get($id); |
|
| 453 | ||
| 454 | $player->update("team", null); |
|
| 455 | $this->update('members', --$this->members); |
|
| 456 | } |
|
| 457 | ||
| 458 | /** |
|
| 459 | * Update the description of the team |
|