From 9e016cc770dd467c194d6263ae3f19634f194893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Tue, 27 May 2014 22:32:54 +0200 Subject: [PATCH] coding & phpdoc improvements --- application/core/ManiaExchange/ManiaExchangeManager.php | 8 ++++---- application/core/Maps/MapCommands.php | 5 ++--- application/core/Maps/MapList.php | 2 +- application/core/Maps/MapManager.php | 5 ++--- application/plugins/MCTeam/ServerRankingPlugin.php | 8 ++++---- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/application/core/ManiaExchange/ManiaExchangeManager.php b/application/core/ManiaExchange/ManiaExchangeManager.php index f0d0987b..49821eef 100644 --- a/application/core/ManiaExchange/ManiaExchangeManager.php +++ b/application/core/ManiaExchange/ManiaExchangeManager.php @@ -71,15 +71,15 @@ class ManiaExchangeManager { /** * Fetch Map Information from Mania Exchange * - * @param null $map + * @param mixed $maps */ - public function fetchManiaExchangeMapInformation($map = null) { - if (!$map) { + public function fetchManiaExchangeMapInformation($maps = null) { + if (!$maps) { //Fetch Information for whole MapList $maps = $this->maniaControl->mapManager->getMaps(); } else { //Fetch Information for a single map - $maps[] = $map; + $maps = (array)$maps; } $mysqli = $this->maniaControl->database->mysqli; diff --git a/application/core/Maps/MapCommands.php b/application/core/Maps/MapCommands.php index 95c530ee..afe20975 100644 --- a/application/core/Maps/MapCommands.php +++ b/application/core/Maps/MapCommands.php @@ -113,13 +113,12 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb $requester = $nextQueued[0]; /** @var Map $map */ $map = $nextQueued[1]; - $this->maniaControl->chat->sendInformation("Next map is $<" . $map->name . "$> from $<" . $map->authorNick . "$> requested by $<" . $requester->nickname . "$>.", $player); + $this->maniaControl->chat->sendInformation("Next Map is $<{$map->nam}$> from $<{$map->authorNick}$> requested by $<{$requester->nickname}$>.", $player); } else { - $mapIndex = $this->maniaControl->client->getNextMapIndex(); $maps = $this->maniaControl->mapManager->getMaps(); $map = $maps[$mapIndex]; - $this->maniaControl->chat->sendInformation("Next map is $<" . $map->name . "$> from $<" . $map->authorNick . "$>.", $player->login); + $this->maniaControl->chat->sendInformation("Next Map is $<{$map->name}$> from $<{$map->authorNick}$>.", $player); } } diff --git a/application/core/Maps/MapList.php b/application/core/Maps/MapList.php index ce8298c3..b337a383 100644 --- a/application/core/Maps/MapList.php +++ b/application/core/Maps/MapList.php @@ -110,7 +110,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { * Display a MapList on the Screen * * @param Player $player - * @param array $mapList + * @param Map[] $mapList * @param int $pageIndex */ public function showMapList(Player $player, $mapList = null, $pageIndex = -1) { diff --git a/application/core/Maps/MapManager.php b/application/core/Maps/MapManager.php index 673c6634..0e807b1b 100644 --- a/application/core/Maps/MapManager.php +++ b/application/core/Maps/MapManager.php @@ -581,8 +581,7 @@ class MapManager implements CallbackListener { * Returns the MapIndex of a given map * * @param Map $map - * @internal param $uid - * @return mixed + * @return int */ public function getMapIndex(Map $map) { $maps = $this->getMaps(); @@ -594,7 +593,7 @@ class MapManager implements CallbackListener { * * @param int $offset * @param int $length - * @return array + * @return Map[] */ public function getMaps($offset = null, $length = null) { if ($offset === null) { diff --git a/application/plugins/MCTeam/ServerRankingPlugin.php b/application/plugins/MCTeam/ServerRankingPlugin.php index 720d6355..1d24b8e4 100644 --- a/application/plugins/MCTeam/ServerRankingPlugin.php +++ b/application/plugins/MCTeam/ServerRankingPlugin.php @@ -193,7 +193,9 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { break; case self::RANKING_TYPE_RECORDS: //TODO verify workable status - if (!$this->maniaControl->pluginManager->isPluginActive(__NAMESPACE__ . '\LocalRecordsPlugin')) { + /** @var LocalRecordsPlugin $localRecordsPlugin */ + $localRecordsPlugin = $this->maniaControl->pluginManager->getPlugin(__NAMESPACE__ . '\LocalRecordsPlugin'); + if (!$localRecordsPlugin) { return; } @@ -212,9 +214,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { } $result->free_result(); - /** @var LocalRecordsPlugin $localRecordsPlugin */ - $localRecordsPlugin = $this->maniaControl->pluginManager->getPlugin(__NAMESPACE__ . '\LocalRecordsPlugin'); - $maps = $this->maniaControl->mapManager->getMaps(); + $maps = $this->maniaControl->mapManager->getMaps(); foreach ($maps as $map) { $records = $localRecordsPlugin->getLocalRecords($map, $maxRecords);