fixed & improved phpdoc

This commit is contained in:
Steffen Schröder 2014-05-09 17:31:29 +02:00
parent e8bcae081a
commit 3b47f0fd9a
8 changed files with 45 additions and 49 deletions

View File

@ -169,7 +169,7 @@ class ChatlogPlugin implements CallbackListener, Plugin {
/**
* Handle Settings Changed Callback
*
* @param array $changedCallback
* @param string $settingClass
*/
public function handleSettingsChangedCallback($settingClass) {
if ($settingClass !== get_class()) {

View File

@ -186,12 +186,13 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
}
/**
* Defines a Vote
* Define a Vote
*
* @param $voteIndex
* @param $voteName
* @param bool $idBased
* @param $neededRatio
* @param int $voteIndex
* @param string $voteName
* @param bool $idBased
* @param string $startText
* @param float $neededRatio
*/
public function defineVote($voteIndex, $voteName, $idBased = false, $startText = '', $neededRatio = -1) {
if ($neededRatio == -1) {
@ -422,11 +423,11 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
}
/**
* Starts a vote
* Start a vote
*
* @param \ManiaControl\Players\Player $player
* @param $voteIndex
* @param $action
* @param Player $player
* @param int $voteIndex
* @param callable $function
*/
public function startVote(Player $player, $voteIndex, $function = null) {
//Player is muted

View File

@ -88,7 +88,7 @@ class DedimaniaData {
}
/**
* Adds a Player to the Players array
* Add a Player to the Players array
*
* @param DedimaniaPlayer $player
*/
@ -98,9 +98,9 @@ class DedimaniaData {
}
/**
* Removes a Dedimania Player by its login
* Remove a Dedimania Player by its login
*
* @param string $player
* @param string $login
*/
public function removePlayer($login) {
unset($this->players[$login]);

View File

@ -237,6 +237,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
* Fetch Dedimania Records
*
* @param bool $reset
* @return bool
*/
private function fetchDedimaniaRecords($reset = true) {
if (!$this->dedimaniaData || $this->dedimaniaData->sessionId == '') {
@ -889,7 +890,8 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
/**
* Inserts the given new Dedimania record at the proper position
*
* @param array $newRecord
* @param RecordData $newRecord
* @param RecordData $oldRecord
* @return bool
*/
private function insertDedimaniaRecord(RecordData &$newRecord, RecordData $oldRecord) {
@ -994,9 +996,9 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
}
/**
* Updates the replay values for the given record
* Update the replay values for the given record
*
* @param array $record
* @param RecordData $record
*/
private function setRecordReplays(RecordData &$record) {
// Set validation replay
@ -1057,11 +1059,6 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
return;
}
$pagesId = '';
if (count($records) > 15) {
$pagesId = 'DediRecordsListPages';
}
//create manialink
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
$script = $maniaLink->getScript();

View File

@ -143,11 +143,11 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
}
/**
* Displays the Donate Widget
* Display the Donation Widget
*
* @param string $login
*/
public function displayDonateWidget($login = false) {
public function displayDonateWidget($login = null) {
$posX = $this->maniaControl->settingManager->getSetting($this, self::SETTING_DONATE_WIDGET_POSX);
$posY = $this->maniaControl->settingManager->getSetting($this, self::SETTING_DONATE_WIDGET_POSY);
$width = $this->maniaControl->settingManager->getSetting($this, self::SETTING_DONATE_WIDGET_WIDTH);
@ -266,13 +266,14 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
}
/**
* Handles a Player Donate
* Handle a Player Donation
*
* @param Player $player
* @param int $value
* @param int $amount
* @param string $receiver
* @param string $receiverName
*/
private function handleDonation(Player $player, $amount, $receiver = '', $receiverName = false) {
private function handleDonation(Player $player, $amount, $receiver = '', $receiverName = null) {
if (!$receiverName) {
$serverName = $this->maniaControl->client->getServerName();
$message = 'Donate ' . $amount . ' Planets to $<' . $serverName . '$>?';

View File

@ -537,11 +537,6 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
// get PlayerList
$records = $this->getLocalRecords($this->maniaControl->mapManager->getCurrentMap());
$pagesId = '';
if (count($records) > 15) {
$pagesId = 'RecordsListPages';
}
// create manialink
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
$script = $maniaLink->getScript();

View File

@ -122,7 +122,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
$type = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MIN_RANKING_TYPE);
if ($type != self::RANKING_TYPE_RECORDS && $type != self::RANKING_TYPE_POINTS && $type != self::RANKING_TYPE_RATIOS) {
$error = 'Ranking Type is not correct, possible values(' . self::RANKING_TYPE_RATIOS . ', ' . self::RANKING_TYPE_POINTS . ', ' . self::RANKING_TYPE_POINTS . ')';
throw new Exception($error);
throw new \Exception($error);
}
//Register CallbackListeners
@ -349,23 +349,24 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
* Shows which Player is next ranked to you
*
* @param Player $player
* @return bool
*/
public function showNextRank(Player $player) {
$rankObject = $this->getRank($player);
if ($rankObject) {
if ($rankObject->rank > 1) {
$nextRank = $this->getNextRank($player);
$nextPlayer = $this->maniaControl->playerManager->getPlayerByIndex($nextRank->playerIndex);
$message = '$0f3The next better ranked player is $fff' . $nextPlayer->nickname;
} else {
$message = '$0f3No better ranked player :-)';
}
$this->maniaControl->chat->sendChat($message, $player->login);
return true;
if (!$rankObject) {
return false;
}
return false;
if ($rankObject->rank > 1) {
$nextRank = $this->getNextRank($player);
$nextPlayer = $this->maniaControl->playerManager->getPlayerByIndex($nextRank->playerIndex);
$message = '$0f3The next better ranked player is $fff' . $nextPlayer->nickname;
} else {
$message = '$0f3No better ranked player :-)';
}
$this->maniaControl->chat->sendChat($message, $player->login);
return true;
}
/**
@ -445,7 +446,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
}
/**
* Provides a ManiaLink window with the top ranks to the player
* Provide a ManiaLink window with the top ranks to the player
*
* @param Player $player
*/
@ -455,7 +456,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
$result = $mysqli->query($query);
if ($mysqli->error) {
trigger_error($mysqli->error);
return null;
return;
}
$width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth();

View File

@ -11,6 +11,7 @@ use FML\ManiaLink;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\TimerListener;
use ManiaControl\Commands\CommandListener;
use ManiaControl\Formatter;
use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\ManialinkManager;
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
@ -272,7 +273,7 @@ class TeamSpeakPlugin implements CallbackListener, CommandListener, ManialinkPag
$joinbutton->setStyle($joinbutton::STYLE_CardButtonSmallWide);
$joinbutton->setText('Join TeamSpeak: ' . $this->maniaControl->settingManager->getSetting($this, self::TEAMSPEAK_SERVERHOST) . ':' . $this->maniaControl->settingManager->getSetting($this, self::TEAMSPEAK_SERVERPORT));
$joinbutton->setTextColor('fff');
$url = 'ts3server://' . $this->maniaControl->settingManager->getSetting($this, self::TEAMSPEAK_SERVERHOST) . '/?port=' . $this->maniaControl->settingManager->getSetting($this, self::TEAMSPEAK_SERVERPORT) . '&nickname=' . rawurlencode(\ManiaControl\Formatter::stripCodes($player->nickname));
$url = 'ts3server://' . $this->maniaControl->settingManager->getSetting($this, self::TEAMSPEAK_SERVERHOST) . '/?port=' . $this->maniaControl->settingManager->getSetting($this, self::TEAMSPEAK_SERVERPORT) . '&nickname=' . rawurlencode(Formatter::stripCodes($player->nickname));
$joinbutton->setUrl($url);
$leftlistQuad = new Quad();