/**
  * trys to leave the given game, returns true on success
  *
  * @param int $id_game
  * @throws ControllerException, NullPointerException
  * @return boolean
  */
 public function leaveGame($id_game)
 {
     $game = ModelGame::getGame($id_game);
     if ($game->getStatus() !== GAME_STATUS_NEW) {
         throw new ControllerException('Can\'t leave game. It has allready started.');
     }
     if ($game->checkProcessing()) {
         throw new ControllerException('Can\'t leave game. It has allready started.');
     }
     ModelIsInGameInfo::leaveGame(ModelUser::getCurrentUser()->getId(), $id_game);
     return true;
 }
 /**
  * kicks the user out of the game (that was given with the constructor)
  *
  * @param int $id_user
  * @param int $id_game
  * @return bool - true if user was kicked
  * @throws GameAdministrationException
  */
 public function kickUser($id_user, $id_game)
 {
     $id_game = intval($id_game);
     $id_user = intval($id_user);
     if (!$this->checkMod() && !$this->checkCreator($id_game)) {
         throw new GameAdministrationException('User not allowed to kick player.');
     }
     if (ModelGame::getGame($id_game)->getStatus() !== GAME_STATUS_NEW) {
         throw new GameAdministrationException('Users can only be removed from new games.');
     }
     ModelIsInGameInfo::leaveGame($id_user, $id_game);
     return true;
 }