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