| @@ 144-154 (lines=11) @@ | ||
| 141 | * |
|
| 142 | * @return bool|null True if both the player was added to the team AND the team member count was incremented |
|
| 143 | */ |
|
| 144 | public function addMember($id) |
|
| 145 | { |
|
| 146 | $player = Player::get($id); |
|
| 147 | ||
| 148 | if (!$player->isTeamless()) { |
|
| 149 | throw new Exception("The player already belongs in a team"); |
|
| 150 | } |
|
| 151 | ||
| 152 | $player->setTeam($this->getId()); |
|
| 153 | $this->update('members', ++$this->members); |
|
| 154 | } |
|
| 155 | ||
| 156 | /** |
|
| 157 | * Increase or decrease the ELO of the team |
|
| @@ 453-463 (lines=11) @@ | ||
| 450 | * @param int $id The id of the player to remove |
|
| 451 | * @return void |
|
| 452 | */ |
|
| 453 | public function removeMember($id) |
|
| 454 | { |
|
| 455 | if (!$this->isMember($id)) { |
|
| 456 | throw new Exception("The player is not a member of that team"); |
|
| 457 | } |
|
| 458 | ||
| 459 | $player = Player::get($id); |
|
| 460 | ||
| 461 | $player->update("team", null); |
|
| 462 | $this->update('members', --$this->members); |
|
| 463 | } |
|
| 464 | ||
| 465 | /** |
|
| 466 | * Update the description of the team |
|