| @@ 145-155 (lines=11) @@ | ||
| 142 | * |
|
| 143 | * @return bool|null True if both the player was added to the team AND the team member count was incremented |
|
| 144 | */ |
|
| 145 | public function addMember($id) |
|
| 146 | { |
|
| 147 | $player = Player::get($id); |
|
| 148 | ||
| 149 | if (!$player->isTeamless()) { |
|
| 150 | throw new Exception("The player already belongs in a team"); |
|
| 151 | } |
|
| 152 | ||
| 153 | $player->setTeam($this->getId()); |
|
| 154 | $this->update('members', ++$this->members); |
|
| 155 | } |
|
| 156 | ||
| 157 | /** |
|
| 158 | * Increase or decrease the ELO of the team |
|
| @@ 470-480 (lines=11) @@ | ||
| 467 | * @param int $id The id of the player to remove |
|
| 468 | * @return void |
|
| 469 | */ |
|
| 470 | public function removeMember($id) |
|
| 471 | { |
|
| 472 | if (!$this->isMember($id)) { |
|
| 473 | throw new Exception("The player is not a member of that team"); |
|
| 474 | } |
|
| 475 | ||
| 476 | $player = Player::get($id); |
|
| 477 | ||
| 478 | $player->update("team", null, "s"); |
|
| 479 | $this->update('members', --$this->members); |
|
| 480 | } |
|
| 481 | ||
| 482 | /** |
|
| 483 | * Update the description of the team |
|