various phpdoc improvements and additions

added some getter methods for properties
This commit is contained in:
Steffen Schröder
2014-07-25 16:28:47 +02:00
parent 29f89ec15f
commit 002b537b47
38 changed files with 381 additions and 188 deletions

View File

@ -46,7 +46,7 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
private $maniaControl = null;
/**
* Create a new Directory Browser Instance
* Create a new directory browser instance
*
* @param ManiaControl $maniaControl
*/

View File

@ -6,7 +6,7 @@ use ManiaControl\ManiaExchange\MXMapInfo;
use ManiaControl\Utils\Formatter;
/**
* Map Model Class
* ManiaControl Map Model Class
*
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014 ManiaControl Team
@ -14,7 +14,7 @@ use ManiaControl\Utils\Formatter;
*/
class Map {
/*
* Public Properties
* Public properties
*/
public $index = -1;
public $name = 'undefined';
@ -42,10 +42,9 @@ class Map {
public $karma = null;
/**
* Create a new Map Object from Rpc Data
* Construct a new map instance from xmlrpc data
*
* @param \Maniaplanet\DedicatedServer\Structures\Map $mpMap
* @internal param \ManiaControl\ManiaControl $maniaControl
*/
public function __construct($mpMap = null) {
$this->startTime = time();
@ -71,7 +70,7 @@ class Map {
}
/**
* Get the escaped Map Name
* Get the escaped map name
*
* @return string
*/
@ -80,7 +79,7 @@ class Map {
}
/**
* Get the Game Type of the Map
* Get the game type of the map
*
* @return string
*/
@ -97,17 +96,12 @@ class Map {
}
/**
* Checks if a map Update is available
* Check whether a map update is available
*
* @return bool
*/
public function updateAvailable() {
if ($this->mx && ($this->lastUpdate < strtotime($this->mx->updated) || $this->uid !== $this->mx->uid)) {
return true;
} else {
return false;
}
return ($this->mx && ($this->lastUpdate < strtotime($this->mx->updated) || $this->uid !== $this->mx->uid));
}
/**
@ -116,4 +110,4 @@ class Map {
public function dump() {
var_dump(json_decode(json_encode($this)));
}
}
}

View File

@ -6,7 +6,7 @@ use ManiaControl\ManiaControl;
use Maniaplanet\DedicatedServer\Xmlrpc\ChangeInProgressException;
/**
* Map Actions Class
* ManiaControl Map Actions Class
*
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014 ManiaControl Team
@ -14,12 +14,12 @@ use Maniaplanet\DedicatedServer\Xmlrpc\ChangeInProgressException;
*/
class MapActions {
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
/**
* Construct a Map Actions Instance
* Construct a map actions instance
*
* @param ManiaControl $maniaControl
*/
@ -28,7 +28,7 @@ class MapActions {
}
/**
* Skips the current Map
* Skip the current Map
*/
public function skipMap() {
//Force a EndMap on the MapQueue to set the next Map

View File

@ -34,14 +34,14 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
const ACTION_SHOW_AUTHOR = 'MapList.ShowAuthorList.';
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
/**
* Create MapCommands instance
* Construct a new map commands instance
*
* @param \ManiaControl\ManiaControl $maniaControl
* @param ManiaControl $maniaControl
*/
public function __construct(ManiaControl $maniaControl) {
$this->maniaControl = $maniaControl;
@ -102,7 +102,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
}
/**
* Shows which map is the next
* Show which map is the next
*
* @param array $chatCallback
* @param Player $player

View File

@ -57,12 +57,12 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
const WIDGET_NAME = 'MapList';
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
/**
* Create a new MapList Instance
* Construct a new map list instance
*
* @param ManiaControl $maniaControl
*/
@ -83,7 +83,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
}
/**
* Clears the Map Queue
* Clear the Map Queue
*
* @param array $chatCallback
* @param Player $player

View File

@ -22,10 +22,8 @@ use Maniaplanet\DedicatedServer\Xmlrpc\InvalidMapException;
use Maniaplanet\DedicatedServer\Xmlrpc\NotInListException;
use Maniaplanet\DedicatedServer\Xmlrpc\UnavailableFeatureException;
// TODO: adding of local maps
/**
* Manager for Maps
* ManiaControl Map Manager Class
*
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014 ManiaControl Team
@ -54,20 +52,29 @@ class MapManager implements CallbackListener {
const CB_ENDMAP = 'Callbacks.EndMap';
/*
* Public Properties
* Public properties
*/
/** @var MapQueue $mapQueue */
public $mapQueue = null;
/** @var MapCommands $mapCommands */
public $mapCommands = null;
public $mapList = null;
public $directoryBrowser = null;
public $mxList = null;
public $mxManager = null;
/** @var MapActions $mapActions */
public $mapActions = null;
/** @var MapList $mapList */
public $mapList = null;
/** @var DirectoryBrowser $directoryBrowser */
public $directoryBrowser = null;
/** @var ManiaExchangeList $mxList */
public $mxList = null;
/** @var ManiaExchangeManager $mxManager */
public $mxManager = null;
/*
* Private Properties
* Private properties
*/
/** @var ManiaControl $maniaControl */
private $maniaControl = null;
/** @var Map[] $maps */
private $maps = array();
/** @var Map $currentMap */
private $currentMap = null;
@ -75,7 +82,7 @@ class MapManager implements CallbackListener {
private $mapBegan = false;
/**
* Construct a new Map Manager
* Construct a new map manager instance
*
* @param ManiaControl $maniaControl
*/
@ -83,7 +90,7 @@ class MapManager implements CallbackListener {
$this->maniaControl = $maniaControl;
$this->initTables();
// Create map commands instance
// Children
$this->mxManager = new ManiaExchangeManager($this->maniaControl);
$this->mapList = new MapList($this->maniaControl);
$this->directoryBrowser = new DirectoryBrowser($this->maniaControl);
@ -92,12 +99,12 @@ class MapManager implements CallbackListener {
$this->mapQueue = new MapQueue($this->maniaControl);
$this->mapActions = new MapActions($maniaControl);
// Register for callbacks
// Callbacks
$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit');
$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_MAPLISTMODIFIED, $this, 'mapsModified');
// Define Rights
// Permissions
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_ADD_MAP, AuthenticationManager::AUTH_LEVEL_ADMIN);
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_REMOVE_MAP, AuthenticationManager::AUTH_LEVEL_ADMIN);
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_ERASE_MAP, AuthenticationManager::AUTH_LEVEL_SUPERADMIN);
@ -106,12 +113,13 @@ class MapManager implements CallbackListener {
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_SKIP_MAP, AuthenticationManager::AUTH_LEVEL_MODERATOR);
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_RESTART_MAP, AuthenticationManager::AUTH_LEVEL_MODERATOR);
// Settings
$this->maniaControl->settingManager->initSetting($this, self::SETTING_AUTOSAVE_MAPLIST, true);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAPLIST_FILE, "MatchSettings/tracklist.txt");
}
/**
* Initialize necessary Database Tables
* Initialize necessary database tables
*
* @return bool
*/
@ -138,6 +146,69 @@ class MapManager implements CallbackListener {
return $result;
}
/**
* Return the map queue
*
* @return MapQueue
*/
public function getMapQueue() {
return $this->mapQueue;
}
/**
* Return the map commands
*
* @return MapCommands
*/
public function getMapCommands() {
return $this->mapCommands;
}
/**
* Return the map actions
*
* @return MapActions
*/
public function getMapActions() {
return $this->mapActions;
}
/**
* Return the map list
*
* @return MapList
*/
public function getMapList() {
return $this->mapList;
}
/**
* Return the directory browser
*
* @return DirectoryBrowser
*/
public function getDirectoryBrowser() {
return $this->directoryBrowser;
}
/**
* Return the mx list
*
* @return ManiaExchangeList
*/
public function getMXList() {
return $this->mxList;
}
/**
* Return the mx manager
*
* @return ManiaExchangeManager
*/
public function getMXManager() {
return $this->mxManager;
}
/**
* Update a Map from Mania Exchange
*

View File

@ -12,7 +12,7 @@ use ManiaControl\Utils\Formatter;
use Maniaplanet\DedicatedServer\Xmlrpc\NextMapException;
/**
* MapQueue Class
* ManiaControl Map Queue Class
*
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014 ManiaControl Team
@ -36,7 +36,7 @@ class MapQueue implements CallbackListener, CommandListener {
const ADMIN_COMMAND_CLEAR_JUKEBOX = 'clearjukebox';
/*
* Private Properties
* Private properties
*/
private $maniaControl = null;
private $queuedMaps = array();
@ -45,7 +45,7 @@ class MapQueue implements CallbackListener, CommandListener {
private $nextNoQueue = false;
/**
* Create a new server MapQueue
* Construct a new map queue instance
*
* @param ManiaControl $maniaControl
*/
@ -80,7 +80,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Adds current map to buffer on startup
* Add current map to buffer on startup
*/
public function handleAfterInit() {
$currentMap = $this->maniaControl->mapManager->getCurrentMap();
@ -88,7 +88,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Clears the map-queue via admin command clear map queue
* Clear the map-queue via admin command clear map queue
*
* @param array $chatCallback
* @param Player $admin
@ -126,7 +126,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Handles the mapqueue/jukebox command
* Handle the mapqueue/jukebox command
*
* @param array $chatCallback
* @param Player $player
@ -156,7 +156,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Shows current mapqueue in the chat
* Show current mapqueue in the chat
*
* @param Player $player
*/
@ -177,7 +177,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Shows current mapqueue in a manialink
* Show current mapqueue in a manialink
*
* @param Player $player
*/
@ -196,7 +196,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Returns the current queue buffer
* Return the current queue buffer
*
* @return string[]
*/
@ -205,7 +205,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Adds map as first map in queue (for /replay)
* Add map as first map in queue (for /replay)
*
* @param Player $player
* @param Map $map
@ -221,7 +221,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Adds a Map to the map-queue
* Add a Map to the map-queue
*
* @param string $login
* @param string $uid
@ -308,7 +308,6 @@ class MapQueue implements CallbackListener, CommandListener {
$this->maniaControl->callbackManager->triggerCallback(self::CB_MAPQUEUE_CHANGED, array('remove', $map));
}
/**
* Called on endmap
*
@ -388,7 +387,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Returns the next Map if the next map is a queuedmap or null if it's not
* Return the next Map if the next map is a queuedmap or null if it's not
*
* @return Map
*/
@ -397,7 +396,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Returns the first Queued Map
* Return the first Queued Map
*
* @return array(Player $player, Map $map)
*/
@ -410,7 +409,7 @@ class MapQueue implements CallbackListener, CommandListener {
}
/**
* Returns a list with the indexes of the queued maps
* Return a list with the indexes of the queued maps
*
* @return array
*/