deprecated getSetting method to keep third-party plugin compatibility

This commit is contained in:
Steffen Schröder 2014-05-13 22:54:26 +02:00
parent 23c58b47ff
commit 55a3ac446a
3 changed files with 23 additions and 15 deletions

View File

@ -44,14 +44,14 @@ class ErrorHandler {
/**
* ManiaControl Exception Handler
*
* @param \Exception $ex
* @param \Exception $exception
* @param bool $shutdown
*/
public function handleException(\Exception $ex, $shutdown = true) {
$message = "[ManiaControl EXCEPTION]: {$ex->getMessage()}";
public function handleException(\Exception $exception, $shutdown = true) {
$message = "[ManiaControl EXCEPTION]: {$exception->getMessage()}";
$exceptionClass = get_class($ex);
$traceString = $ex->getTraceAsString();
$exceptionClass = get_class($exception);
$traceString = $exception->getTraceAsString();
$logMessage = $message . PHP_EOL . 'Class: ' . $exceptionClass . PHP_EOL . 'Trace:' . PHP_EOL . $traceString;
logMessage($logMessage);
@ -61,7 +61,7 @@ class ErrorHandler {
$error['Type'] = 'Exception';
$error['Message'] = $message;
$error['Class'] = $exceptionClass;
$error['FileLine'] = $ex->getFile() . ': ' . $ex->getLine();
$error['FileLine'] = $exception->getFile() . ': ' . $exception->getLine();
$error['Backtrace'] = $traceString;
$error['OperatingSystem'] = php_uname();
$error['PHPVersion'] = phpversion();

View File

@ -105,14 +105,14 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
* @param array $chat
* @param Player $player
*/
public function command_ShowNextMap(array $chat, Player $player) {
public function command_ShowNextMap(array $chatCallback, Player $player) {
$nextQueued = $this->maniaControl->mapManager->mapQueue->getNextQueuedMap();
if ($nextQueued) {
/** @var Player $requester */
$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->login);
$this->maniaControl->chat->sendInformation("Next map is $<" . $map->name . "$> from $<" . $map->authorNick . "$> requested by $<" . $requester->nickname . "$>.", $player);
} else {
$mapIndex = $this->maniaControl->client->getNextMapIndex();
@ -126,9 +126,9 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
* Handle removemap command
*
* @param array $chat
* @param \ManiaControl\Players\Player $player
* @param Player $player
*/
public function command_RemoveMap(array $chat, Player $player) {
public function command_RemoveMap(array $chatCallback, Player $player) {
if (!$this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_REMOVE_MAP)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player);
return;
@ -136,7 +136,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
// Get map
$map = $this->maniaControl->mapManager->getCurrentMap();
if (!$map) {
$this->maniaControl->chat->sendError("Couldn't remove map.", $player->login);
$this->maniaControl->chat->sendError("Couldn't remove map.", $player);
return;
}

View File

@ -136,7 +136,7 @@ class SettingManager implements CallbackListener {
public function setSetting($object, $settingName, $value) {
$className = ClassUtil::getClass($object);
$setting = $this->getSetting($object, $settingName);
$setting = $this->getSettingObject($object, $settingName);
if ($setting) {
$setting->value = $value;
if (!$this->saveSetting($setting)) {
@ -162,7 +162,7 @@ class SettingManager implements CallbackListener {
* @param mixed $default
* @return Setting
*/
public function getSetting($object, $settingName, $default = null) {
public function getSettingObject($object, $settingName, $default = null) {
$settingClass = ClassUtil::getClass($object);
// Retrieve from Storage if possible
@ -262,6 +262,14 @@ class SettingManager implements CallbackListener {
return true;
}
/**
* @deprecated
* @see SettingManager::getSettingValue()
*/
public function getSetting($object, $settingName, $default = null) {
return $this->getSettingValue($object, $settingName, $default);
}
/**
* Get the Setting Value directly
*
@ -271,7 +279,7 @@ class SettingManager implements CallbackListener {
* @return mixed
*/
public function getSettingValue($object, $settingName, $default = null) {
$setting = $this->getSetting($object, $settingName, $default);
$setting = $this->getSettingObject($object, $settingName, $default);
if ($setting) {
return $setting->value;
}