coding & phpdoc improvements continued #2

This commit is contained in:
Steffen Schröder 2014-05-27 22:50:28 +02:00
parent c284feb843
commit b92b592900
3 changed files with 22 additions and 18 deletions

View File

@ -190,7 +190,7 @@ class MapQueue implements CallbackListener, CommandListener {
/**
* Returns the current queue buffer
*
* @return array
* @return string[]
*/
public function getQueueBuffer() {
return $this->buffer;

View File

@ -230,7 +230,7 @@ class PluginManager {
/**
* Load complete Plugins Directory and start all configured Plugins
*
* @return array
* @return string[]
*/
public function loadPlugins() {
$pluginsDirectory = ManiaControlDir . 'plugins' . DIRECTORY_SEPARATOR;
@ -402,16 +402,32 @@ class PluginManager {
/**
* Get all declared plugin class names
*
* @return array
* @return string[]
*/
public function getPluginClasses() {
return $this->pluginClasses;
}
/**
* Get all active plugins
* Get the Ids of all active Plugins
*
* @return array
* @return string[]
*/
public function getActivePluginsIds() {
$pluginsIds = array();
foreach ($this->getActivePlugins() as $plugin) {
$pluginId = $plugin::getId();
if (is_numeric($pluginId)) {
array_push($pluginsIds, $pluginId);
}
}
return $pluginsIds;
}
/**
* Get all active Plugins
*
* @return Plugin[]
*/
public function getActivePlugins() {
return $this->activePlugins;

View File

@ -4,7 +4,6 @@ namespace ManiaControl\Server;
use ManiaControl\Callbacks\TimerListener;
use ManiaControl\ManiaControl;
use ManiaControl\Plugins\Plugin;
use ManiaControl\Utils\Formatter;
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
@ -73,18 +72,7 @@ class UsageReporter implements TimerListener {
$properties['ScriptName'] = '';
}
$activePlugins = array();
if (is_array($this->maniaControl->pluginManager->getActivePlugins())) {
foreach ($this->maniaControl->pluginManager->getActivePlugins() as $plugin) {
/** @var Plugin $plugin */
if (!is_null($plugin::getId()) && is_numeric($plugin::getId())) {
$activePlugins[] = $plugin::getId();
}
}
}
$properties['ActivePlugins'] = $activePlugins;
$properties['ActivePlugins'] = $this->maniaControl->pluginManager->getActivePluginsIds();
$json = json_encode($properties);
$info = base64_encode($json);