protected function createResponse() { $playerRepository = new PlayerRepository(); $count = $playerRepository->getCountByGameAndCharakter($this->game['id'], 0); if ($count === 0) { return Command::setup('command=start', $this->game); } return ''; }
protected function check() { if ($this->game && $this->game['status'] != Game::GAME_STATUS_ENDED) { if ($this->game['status'] == Game::GAME_STATUS_INITIALIZED) { $playerRepository = new PlayerRepository(); $count = $playerRepository->getCountByGameAndCharakter($this->game['id'], 0); if ($count === 0) { $this->check = self::OK; } else { $this->check = self::SOME_PLAYERS_WITHOUT_CHARACTER; } } elseif ($this->game['status'] == Game::GAME_STATUS_CREATED) { $this->check = self::NOT_YET_INITIALIZED; } elseif ($this->game['status'] == Game::GAME_STATUS_STARTED) { $this->check = self::ALREADY_STARTED; } else { $this->check = self::SOMETHING_ELSE; } } else { $this->check = self::NO_GAME; } }