phpdoc improvements
This commit is contained in:
parent
30459811c0
commit
1a8c6ad036
@ -17,8 +17,10 @@ class Database implements TimerListener {
|
||||
/*
|
||||
* Public properties
|
||||
*/
|
||||
/** @var \mysqli $mysqli */
|
||||
/** @deprecated see getMysqli() */
|
||||
/** @var \mysqli $mysqli
|
||||
* @deprecated
|
||||
* @see Database::getMysqli()
|
||||
*/
|
||||
public $mysqli = null;
|
||||
|
||||
/*
|
||||
@ -76,28 +78,28 @@ class Database implements TimerListener {
|
||||
if (!$hostElements) {
|
||||
$this->maniaControl->quit("Invalid database configuration (Host).", true);
|
||||
}
|
||||
$host = (string)$hostElements[0];
|
||||
$host = (string) $hostElements[0];
|
||||
|
||||
// Port
|
||||
$portElements = $databaseElement->xpath('port');
|
||||
if (!$portElements) {
|
||||
$this->maniaControl->quit("Invalid database configuration (Port).", true);
|
||||
}
|
||||
$port = (string)$portElements[0];
|
||||
$port = (string) $portElements[0];
|
||||
|
||||
// User
|
||||
$userElements = $databaseElement->xpath('user');
|
||||
if (!$userElements) {
|
||||
$this->maniaControl->quit("Invalid database configuration (User).", true);
|
||||
}
|
||||
$user = (string)$userElements[0];
|
||||
$user = (string) $userElements[0];
|
||||
|
||||
// Pass
|
||||
$passElements = $databaseElement->xpath('pass');
|
||||
if (!$passElements) {
|
||||
$this->maniaControl->quit("Invalid database configuration (Pass).", true);
|
||||
}
|
||||
$pass = (string)$passElements[0];
|
||||
$pass = (string) $passElements[0];
|
||||
|
||||
// Name
|
||||
$nameElements = $databaseElement->xpath('name');
|
||||
@ -107,7 +109,7 @@ class Database implements TimerListener {
|
||||
if (!$nameElements) {
|
||||
$this->maniaControl->quit("Invalid database configuration (Name).", true);
|
||||
}
|
||||
$name = (string)$nameElements[0];
|
||||
$name = (string) $nameElements[0];
|
||||
|
||||
// Create config object
|
||||
$config = new Config($host, $port, $user, $pass, $name);
|
||||
@ -117,6 +119,15 @@ class Database implements TimerListener {
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the mysqli instance
|
||||
*
|
||||
* @return \mysqli
|
||||
*/
|
||||
public function getMysqli() {
|
||||
return $this->mysqli;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to the defined Database
|
||||
*
|
||||
@ -186,15 +197,6 @@ class Database implements TimerListener {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the mysqli instance
|
||||
*
|
||||
* @return \mysqli
|
||||
*/
|
||||
public function getMysqli() {
|
||||
return $this->mysqli;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the database config
|
||||
*
|
||||
@ -217,9 +219,7 @@ class Database implements TimerListener {
|
||||
* Check whether the Database Connection is still open
|
||||
*/
|
||||
public function checkConnection() {
|
||||
if (!$this->getMysqli()
|
||||
|| !$this->getMysqli()->ping()
|
||||
) {
|
||||
if (!$this->getMysqli() || !$this->getMysqli()->ping()) {
|
||||
$this->maniaControl->quit('The MySQL Server has gone away!', true);
|
||||
}
|
||||
}
|
||||
|
@ -54,87 +54,108 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener {
|
||||
* Public properties
|
||||
*/
|
||||
/** @var ActionsMenu $actionsMenu
|
||||
* @deprecated see getActionsMenu()
|
||||
* @deprecated
|
||||
* @see getActionsMenu()
|
||||
*/
|
||||
public $actionsMenu = null;
|
||||
/** @var AuthenticationManager $authenticationManager
|
||||
* @deprecated see getAuthenticationManager()
|
||||
* @deprecated
|
||||
* @see getAuthenticationManager()
|
||||
*/
|
||||
public $authenticationManager = null;
|
||||
/** @var CallbackManager $callbackManager
|
||||
* @deprecated see getCallbackManager()
|
||||
* @deprecated
|
||||
* @see getCallbackManager()
|
||||
*/
|
||||
public $callbackManager = null;
|
||||
/** @var Chat $chat
|
||||
* @deprecated see getChat()
|
||||
* @deprecated
|
||||
* @see getChat()
|
||||
*/
|
||||
public $chat = null;
|
||||
/** @var \SimpleXMLElement $config
|
||||
* @deprecated see getConfig()
|
||||
* @deprecated
|
||||
* @see getConfig()
|
||||
*/
|
||||
public $config = null;
|
||||
/** @var Configurator $configurator
|
||||
* @deprecated see getConfigurator()
|
||||
* @deprecated
|
||||
* @see getConfigurator()
|
||||
*/
|
||||
public $configurator = null;
|
||||
/** @var Connection $client
|
||||
* @deprecated see getClient()
|
||||
* @deprecated
|
||||
* @see getClient()
|
||||
*/
|
||||
public $client = null;
|
||||
/** @var CommandManager $commandManager
|
||||
* @deprecated see getCommandManager()
|
||||
* @deprecated
|
||||
* @see getCommandManager()
|
||||
*/
|
||||
public $commandManager = null;
|
||||
/** @var Database $database
|
||||
* @deprecated see getDatabase()
|
||||
* @deprecated
|
||||
* @see getDatabase()
|
||||
*/
|
||||
public $database = null;
|
||||
/** @var ManialinkManager $manialinkManager
|
||||
* @deprecated see getManialinkManager
|
||||
* @deprecated
|
||||
* @see getManialinkManager
|
||||
*/
|
||||
public $manialinkManager = null;
|
||||
/** @var MapManager $mapManager
|
||||
* @deprecated see getMapManager()
|
||||
* @deprecated
|
||||
* @see getMapManager()
|
||||
*/
|
||||
public $mapManager = null;
|
||||
/** @var PlayerManager $playerManager
|
||||
* @deprecated see getPlayerManager()
|
||||
* @deprecated
|
||||
* @see getPlayerManager()
|
||||
*/
|
||||
public $playerManager = null;
|
||||
/** @var PluginManager $pluginManager
|
||||
* @deprecated see getPluginManager()
|
||||
* @deprecated
|
||||
* @see getPluginManager()
|
||||
*/
|
||||
public $pluginManager = null;
|
||||
/** @var Server $server
|
||||
* @deprecated see getServer()
|
||||
* @deprecated
|
||||
* @see getServer()
|
||||
*/
|
||||
public $server = null;
|
||||
/** @var SettingManager $settingManager
|
||||
* @deprecated see getSettingManager()
|
||||
* @deprecated
|
||||
* @see getSettingManager()
|
||||
*/
|
||||
public $settingManager = null;
|
||||
/** @var StatisticManager $statisticManager
|
||||
* @deprecated see getStatisticManager()
|
||||
* @deprecated
|
||||
* @see getStatisticManager()
|
||||
*/
|
||||
public $statisticManager = null;
|
||||
/** @var UpdateManager $updateManager
|
||||
* @deprecated see getUpdateManager()
|
||||
* @deprecated
|
||||
* @see getUpdateManager()
|
||||
*/
|
||||
public $updateManager = null;
|
||||
/** @var ErrorHandler $errorHandler
|
||||
* @deprecated see getErrorHandler()
|
||||
* @deprecated
|
||||
* @see getErrorHandler()
|
||||
*/
|
||||
public $errorHandler = null;
|
||||
/** @var TimerManager $timerManager
|
||||
* @deprecated see getTimerManager()
|
||||
* @deprecated
|
||||
* @see getTimerManager()
|
||||
*/
|
||||
public $timerManager = null;
|
||||
/** @var AsynchronousFileReader $fileReader
|
||||
* @deprecated see getFileReader()
|
||||
* @deprecated
|
||||
* @see getFileReader()
|
||||
*/
|
||||
public $fileReader = null;
|
||||
/** @var BillManager $billManager
|
||||
* @deprecated see getBillManager()
|
||||
* @deprecated
|
||||
* @see getBillManager()
|
||||
*/
|
||||
public $billManager = null;
|
||||
|
||||
@ -612,7 +633,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener {
|
||||
// Yield for next tick
|
||||
$loopEnd = microtime(true);
|
||||
$loopDuration = $loopEnd - $loopStart;
|
||||
$sleepTime = (int)(2500 - $loopDuration * 1000000);
|
||||
$sleepTime = (int) (2500 - $loopDuration * 1000000);
|
||||
if ($sleepTime > 0) {
|
||||
usleep($sleepTime);
|
||||
}
|
||||
|
@ -33,13 +33,19 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
|
||||
* Public properties
|
||||
*/
|
||||
/** @var StyleManager $styleManager */
|
||||
/** @deprecated see getStyleManager() */
|
||||
/** @deprecated
|
||||
* @see getStyleManager()
|
||||
*/
|
||||
public $styleManager = null;
|
||||
/** @var CustomUIManager $customUIManager */
|
||||
/** @deprecated see getCustomUIManager() */
|
||||
/** @deprecated
|
||||
* @see getCustomUIManager()
|
||||
*/
|
||||
public $customUIManager = null;
|
||||
/** @var IconManager $iconManager */
|
||||
/** @deprecated see getIconManager() */
|
||||
/** @deprecated
|
||||
* @see getIconManager()
|
||||
*/
|
||||
public $iconManager = null;
|
||||
|
||||
/*
|
||||
@ -48,7 +54,7 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
|
||||
/** @var ManiaControl $maniaControl */
|
||||
private $maniaControl = null;
|
||||
// TODO: use listening class
|
||||
private $pageAnswerListeners = array();
|
||||
private $pageAnswerListeners = array();
|
||||
private $pageAnswerRegexListener = array();
|
||||
|
||||
/**
|
||||
@ -225,7 +231,7 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
|
||||
* @return bool
|
||||
*/
|
||||
public function sendManialink($manialinkText, $logins = null, $timeout = 0, $hideOnClick = false) {
|
||||
$manialinkText = (string)$manialinkText;
|
||||
$manialinkText = (string) $manialinkText;
|
||||
|
||||
if (!$manialinkText) {
|
||||
return true;
|
||||
|
@ -51,26 +51,40 @@ class MapManager implements CallbackListener {
|
||||
/*
|
||||
* Public properties
|
||||
*/
|
||||
/** @var MapQueue $mapQueue */
|
||||
/** @deprecated see getMapQueue() */
|
||||
/** @var MapQueue $mapQueue
|
||||
* @deprecated
|
||||
* @see getMapQueue()
|
||||
*/
|
||||
public $mapQueue = null;
|
||||
/** @var MapCommands $mapCommands */
|
||||
/** @deprecated see getMapCommands() */
|
||||
/** @var MapCommands $mapCommands
|
||||
* @deprecated
|
||||
* @see getMapCommands()
|
||||
*/
|
||||
public $mapCommands = null;
|
||||
/** @var MapActions $mapActions */
|
||||
/** @deprecated see getMapActions() */
|
||||
/** @var MapActions $mapActions
|
||||
* @deprecated
|
||||
* @see getMapActions()
|
||||
*/
|
||||
public $mapActions = null;
|
||||
/** @var MapList $mapList */
|
||||
/** @deprecated see getMapList() */
|
||||
/** @var MapList $mapList
|
||||
* @deprecated
|
||||
* @see getMapList()
|
||||
*/
|
||||
public $mapList = null;
|
||||
/** @var DirectoryBrowser $directoryBrowser */
|
||||
/** @deprecated see getDirectoryBrowser() */
|
||||
/** @var DirectoryBrowser $directoryBrowser
|
||||
* @deprecated
|
||||
* @see getDirectoryBrowser()
|
||||
*/
|
||||
public $directoryBrowser = null;
|
||||
/** @var ManiaExchangeList $mxList */
|
||||
/** @deprecated see getMXList() */
|
||||
/** @var ManiaExchangeList $mxList
|
||||
* @deprecated
|
||||
* @see getMXList()
|
||||
*/
|
||||
public $mxList = null;
|
||||
/** @var ManiaExchangeManager $mxManager */
|
||||
/** @deprecated see getMXManager() */
|
||||
/** @var ManiaExchangeManager $mxManager
|
||||
* @deprecated
|
||||
* @see getMXManager()
|
||||
*/
|
||||
public $mxManager = null;
|
||||
|
||||
/*
|
||||
@ -82,8 +96,8 @@ class MapManager implements CallbackListener {
|
||||
private $maps = array();
|
||||
/** @var Map $currentMap */
|
||||
private $currentMap = null;
|
||||
private $mapEnded = false;
|
||||
private $mapBegan = false;
|
||||
private $mapEnded = false;
|
||||
private $mapBegan = false;
|
||||
|
||||
/**
|
||||
* Construct a new map manager instance
|
||||
|
@ -515,9 +515,13 @@ class PlayerActions {
|
||||
/**
|
||||
* Check if a Player is muted
|
||||
*
|
||||
* @deprecated see Player/isMuted()
|
||||
* @deprecated
|
||||
* @see Player::isMuted()
|
||||
*/
|
||||
public function isPlayerMuted($login) {
|
||||
return $this->maniaControl->getPlayerManager()->getPlayer($login)->isMuted();
|
||||
if ($player = $this->maniaControl->getPlayerManager()->getPlayer($login)) {
|
||||
return $player->isMuted();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -37,23 +37,35 @@ class PlayerManager implements CallbackListener, TimerListener {
|
||||
/*
|
||||
* Public properties
|
||||
*/
|
||||
/** @var PlayerActions $playerActions */
|
||||
/** @deprecated see getPlayerActions() */
|
||||
/** @var PlayerActions $playerActions
|
||||
* @deprecated
|
||||
* @see getPlayerActions()
|
||||
*/
|
||||
public $playerActions = null;
|
||||
/** @var PlayerCommands $playerCommands */
|
||||
/** @deprecated see getPlayerCommands() */
|
||||
/** @var PlayerCommands $playerCommands
|
||||
* @deprecated
|
||||
* @see getPlayerCommands()
|
||||
*/
|
||||
public $playerCommands = null;
|
||||
/** @var PlayerDetailed $playerDetailed */
|
||||
/** @deprecated see getPlayerDetailed() */
|
||||
/** @var PlayerDetailed $playerDetailed
|
||||
* @deprecated
|
||||
* @see getPlayerDetailed()
|
||||
*/
|
||||
public $playerDetailed = null;
|
||||
/** @var PlayerDataManager $playerDataManager */
|
||||
/** @deprecated see getPlayerDataManager() */
|
||||
/** @var PlayerDataManager $playerDataManager
|
||||
* @deprecated
|
||||
* @see getPlayerDataManager()
|
||||
*/
|
||||
public $playerDataManager = null;
|
||||
/** @var PlayerList $playerList */
|
||||
/** @deprecated see getPlayerList() */
|
||||
/** @var PlayerList $playerList
|
||||
* @deprecated
|
||||
* @see getPlayerList()
|
||||
*/
|
||||
public $playerList = null;
|
||||
/** @var AdminLists $adminLists */
|
||||
/** @deprecated see getAdminLists() */
|
||||
/** @var AdminLists $adminLists
|
||||
* @deprecated
|
||||
* @see getAdminLists()
|
||||
*/
|
||||
public $adminLists = null;
|
||||
|
||||
/*
|
||||
@ -154,15 +166,6 @@ class PlayerManager implements CallbackListener, TimerListener {
|
||||
return $this->playerDetailed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the player data manager
|
||||
*
|
||||
* @return PlayerDataManager
|
||||
*/
|
||||
public function getPlayerDataManager() {
|
||||
return $this->playerDataManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the player list
|
||||
*
|
||||
@ -386,6 +389,15 @@ class PlayerManager implements CallbackListener, TimerListener {
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the player data manager
|
||||
*
|
||||
* @return PlayerDataManager
|
||||
*/
|
||||
public function getPlayerDataManager() {
|
||||
return $this->playerDataManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update PlayerInfo
|
||||
*
|
||||
|
@ -28,27 +28,37 @@ class Server implements CallbackListener {
|
||||
* Public properties
|
||||
*/
|
||||
/** @var Config $config */
|
||||
public $config = null;
|
||||
public $index = -1;
|
||||
public $ip = null;
|
||||
public $port = -1;
|
||||
public $config = null;
|
||||
public $index = -1;
|
||||
public $ip = null;
|
||||
public $port = -1;
|
||||
public $p2pPort = -1;
|
||||
public $login = null;
|
||||
public $login = null;
|
||||
public $titleId = null;
|
||||
/** @var Directory $directory */
|
||||
/** @deprecated see getDirectory() */
|
||||
/** @var Directory $directory
|
||||
* @deprecated
|
||||
* @see getDirectory()
|
||||
*/
|
||||
public $directory = null;
|
||||
/** @var Commands $commands */
|
||||
/** @deprecated see getCommands() */
|
||||
/** @var Commands $commands
|
||||
* @deprecated
|
||||
* @see getCommands()
|
||||
*/
|
||||
public $commands = null;
|
||||
/** @var UsageReporter $usageReporter */
|
||||
/** @deprecated see getUsageReporter() */
|
||||
/** @var UsageReporter $usageReporter
|
||||
* @deprecated
|
||||
* @see getUsageReporter()
|
||||
*/
|
||||
public $usageReporter = null;
|
||||
/** @var RankingManager $rankingManager */
|
||||
/** @deprecated see getRankingManager() */
|
||||
/** @var RankingManager $rankingManager
|
||||
* @deprecated
|
||||
* @see getRankingManager()
|
||||
*/
|
||||
public $rankingManager = null;
|
||||
/** @var ScriptManager $scriptManager */
|
||||
/** @deprecated see getScriptManager() */
|
||||
/** @var ScriptManager $scriptManager
|
||||
* @deprecated
|
||||
* @see getScriptManager()
|
||||
*/
|
||||
public $scriptManager = null;
|
||||
|
||||
/*
|
||||
@ -56,7 +66,7 @@ class Server implements CallbackListener {
|
||||
*/
|
||||
/** @var ManiaControl $maniaControl */
|
||||
private $maniaControl = null;
|
||||
private $teamMode = null;
|
||||
private $teamMode = null;
|
||||
|
||||
/**
|
||||
* Construct a new Server
|
||||
@ -113,15 +123,6 @@ class Server implements CallbackListener {
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the server directory
|
||||
*
|
||||
* @return Directory
|
||||
*/
|
||||
public function getDirectory() {
|
||||
return $this->directory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the server commands
|
||||
*
|
||||
@ -335,6 +336,15 @@ class Server implements CallbackListener {
|
||||
return $ghostReplay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the server directory
|
||||
*
|
||||
* @return Directory
|
||||
*/
|
||||
public function getDirectory() {
|
||||
return $this->directory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if ManiaControl has Access to the given Directory
|
||||
*
|
||||
@ -422,7 +432,7 @@ class Server implements CallbackListener {
|
||||
*/
|
||||
public function setTeamMode($teamMode = true) {
|
||||
$oldStatus = $this->teamMode;
|
||||
$this->teamMode = (bool)$teamMode;
|
||||
$this->teamMode = (bool) $teamMode;
|
||||
|
||||
// Trigger callback
|
||||
if ($oldStatus !== $this->teamMode | $oldStatus === null) {
|
||||
|
@ -22,7 +22,7 @@ class StatisticManager {
|
||||
const STAT_TYPE_TIME = '1';
|
||||
const STAT_TYPE_FLOAT = '2';
|
||||
|
||||
const SPECIAL_STAT_KD_RATIO = 'Kill Death Ratio'; //TODO dynamic later
|
||||
const SPECIAL_STAT_KD_RATIO = 'Kill Death Ratio'; //TODO dynamic later
|
||||
const SPECIAL_STAT_HITS_PH = 'Hits Per Hour';
|
||||
const SPECIAL_STAT_LASER_ACC = 'Laser Accuracy';
|
||||
const SPECIAL_STAT_NUCLEUS_ACC = 'Nucleus Accuracy';
|
||||
@ -32,11 +32,15 @@ class StatisticManager {
|
||||
/*
|
||||
* Public properties
|
||||
*/
|
||||
/** @var StatisticCollector $statisticCollector */
|
||||
/** @deprecated see getStatisticCollector() */
|
||||
/** @var StatisticCollector $statisticCollector
|
||||
* @deprecated
|
||||
* @see getStatisticCollector()
|
||||
*/
|
||||
public $statisticCollector = null;
|
||||
/** @var SimpleStatsList $simpleStatsList */
|
||||
/** @deprecated see getSimpleStatsList() */
|
||||
/** @var SimpleStatsList $simpleStatsList
|
||||
* @deprecated
|
||||
* @see getSimpleStatsList()
|
||||
*/
|
||||
public $simpleStatsList = null;
|
||||
|
||||
/*
|
||||
@ -44,7 +48,7 @@ class StatisticManager {
|
||||
*/
|
||||
/** @var ManiaControl $maniaControl */
|
||||
private $maniaControl = null;
|
||||
private $stats = array();
|
||||
private $stats = array();
|
||||
private $specialStats = array();
|
||||
|
||||
/**
|
||||
@ -343,7 +347,7 @@ class StatisticManager {
|
||||
private function getStatId($statName) {
|
||||
if (isset($this->stats[$statName])) {
|
||||
$stat = $this->stats[$statName];
|
||||
return (int)$stat->index;
|
||||
return (int) $stat->index;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -429,7 +433,7 @@ class StatisticManager {
|
||||
if (!$shots) {
|
||||
continue;
|
||||
}
|
||||
$playerStats[$stat->name] = array($stat, (float)($hits / $shots));
|
||||
$playerStats[$stat->name] = array($stat, (float) ($hits / $shots));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,8 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
|
||||
* Public properties
|
||||
*/
|
||||
/** @var PluginUpdateManager $pluginUpdateManager
|
||||
* @deprecated see getPluginUpdateManager()
|
||||
* @deprecated
|
||||
* @see getPluginUpdateManager()
|
||||
*/
|
||||
public $pluginUpdateManager = null;
|
||||
|
||||
@ -48,7 +49,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
|
||||
* Private properties
|
||||
*/
|
||||
/** @var ManiaControl $maniaControl */
|
||||
private $maniaControl = null;
|
||||
private $maniaControl = null;
|
||||
private $currentBuildDate = null;
|
||||
/** @var UpdateData $coreUpdateData */
|
||||
private $coreUpdateData = null;
|
||||
@ -403,7 +404,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
|
||||
*/
|
||||
public function setBuildDate($date) {
|
||||
$nightlyBuildDateFile = MANIACONTROL_PATH . 'core' . DIRECTORY_SEPARATOR . self::BUILD_DATE_FILE_NAME;
|
||||
$success = (bool)file_put_contents($nightlyBuildDateFile, $date);
|
||||
$success = (bool) file_put_contents($nightlyBuildDateFile, $date);
|
||||
$this->currentBuildDate = $date;
|
||||
return $success;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user