/**
  * Get object containing the output data for a single server
  * 
  * @param \SQ\Gameserver $gs 
  * @return \SQ\TemplateHolder Object containing template values
  */
 private static function getServerTemplateData(Gameserver $gs)
 {
     $server = new TemplateHolder();
     $server->online = $gs->isOnline();
     $server->error = $gs->getError();
     $gameId = $gs->getGameId();
     $server->gameId = $gameId;
     $server->gameName = self::cleanOutput(Config::$games[$gameId]['name']);
     $server->gameIcon = self::getGameImageURL($gameId);
     $server->addr = $gs->getAddress();
     $server->link = $gs->getConnectLink();
     $server->name = self::cleanOutput($gs->getName());
     $server->map = self::cleanOutput($gs->getMapName());
     $server->playerCount = $gs->getPlayerCount();
     $server->maxPlayers = $gs->getMaxPlayers();
     $server->players = $gs->getPlayerList();
     if ($server->players !== null) {
         $server->players = array_map(array('self', 'cleanOutput'), $server->players);
     }
     return $server;
 }
Beispiel #2
0
 /**
  * Get the cache key based on a Gameserver object
  *
  * @param \SQ\Gameserver $server
  * @return string
  */
 private static function getKey(Gameserver $server)
 {
     return 'sq_' . $server->getGameId() . '_' . str_replace(':', '_', $server->getAddress());
 }