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 * Returns the current queue buffer
* *
* @return array * @return string[]
*/ */
public function getQueueBuffer() { public function getQueueBuffer() {
return $this->buffer; return $this->buffer;

View File

@ -230,7 +230,7 @@ class PluginManager {
/** /**
* Load complete Plugins Directory and start all configured Plugins * Load complete Plugins Directory and start all configured Plugins
* *
* @return array * @return string[]
*/ */
public function loadPlugins() { public function loadPlugins() {
$pluginsDirectory = ManiaControlDir . 'plugins' . DIRECTORY_SEPARATOR; $pluginsDirectory = ManiaControlDir . 'plugins' . DIRECTORY_SEPARATOR;
@ -402,16 +402,32 @@ class PluginManager {
/** /**
* Get all declared plugin class names * Get all declared plugin class names
* *
* @return array * @return string[]
*/ */
public function getPluginClasses() { public function getPluginClasses() {
return $this->pluginClasses; 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() { public function getActivePlugins() {
return $this->activePlugins; return $this->activePlugins;

View File

@ -4,7 +4,6 @@ namespace ManiaControl\Server;
use ManiaControl\Callbacks\TimerListener; use ManiaControl\Callbacks\TimerListener;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Plugins\Plugin;
use ManiaControl\Utils\Formatter; use ManiaControl\Utils\Formatter;
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException; use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
@ -73,18 +72,7 @@ class UsageReporter implements TimerListener {
$properties['ScriptName'] = ''; $properties['ScriptName'] = '';
} }
$activePlugins = array(); $properties['ActivePlugins'] = $this->maniaControl->pluginManager->getActivePluginsIds();
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;
$json = json_encode($properties); $json = json_encode($properties);
$info = base64_encode($json); $info = base64_encode($json);