diff --git a/DatabaseConverter.php b/DatabaseConverter.php index b22793e1..83458c06 100644 --- a/DatabaseConverter.php +++ b/DatabaseConverter.php @@ -119,7 +119,7 @@ class DatabaseConverter { //TODO move bind param before loop everywhere, convert */ public function __destruct() { $this->mysqli->close(); - if ($this->sourceMysqli != null) { + if ($this->sourceMysqli) { $this->sourceMysqli->close(); } } diff --git a/application/core/Admin/AdminLists.php b/application/core/Admin/AdminLists.php index 575ef4a8..23f4381f 100644 --- a/application/core/Admin/AdminLists.php +++ b/application/core/Admin/AdminLists.php @@ -220,7 +220,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener { foreach($this->adminListShown as $login => $shown) { if ($shown) { $player = $this->maniaControl->playerManager->getPlayer($login); - if ($player != null) { + if ($player) { $this->showAdminLists($player); } else { unset($this->adminListShown[$login]); diff --git a/application/core/ManiaExchange/ManiaExchangeManager.php b/application/core/ManiaExchange/ManiaExchangeManager.php index 46d3f835..7600e8c4 100644 --- a/application/core/ManiaExchange/ManiaExchangeManager.php +++ b/application/core/ManiaExchange/ManiaExchangeManager.php @@ -248,9 +248,9 @@ class ManiaExchangeManager{ $maps = array(); foreach($mxMapList as $map) { - if ($map != null) { + if ($map) { $mxMapObject = new MXMapInfo($titlePrefix, $map); - if ($mxMapObject != null) { + if ($mxMapObject) { array_push($maps, $mxMapObject); } } diff --git a/application/core/Maps/Map.php b/application/core/Maps/Map.php index c3c2bc6d..56ff1bf0 100644 --- a/application/core/Maps/Map.php +++ b/application/core/Maps/Map.php @@ -90,7 +90,7 @@ class Map { */ public function updateAvailable() { - if ($this->mx != null && ($this->lastUpdate < strtotime($this->mx->updated) || $this->uid != $this->mx->uid)) { + if ($this->mx && ($this->lastUpdate < strtotime($this->mx->updated) || $this->uid != $this->mx->uid)) { return true; } else { return false; diff --git a/application/core/Maps/MapCommands.php b/application/core/Maps/MapCommands.php index f0ee9ed0..6e38b2ba 100644 --- a/application/core/Maps/MapCommands.php +++ b/application/core/Maps/MapCommands.php @@ -98,7 +98,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb */ public function command_ShowNextMap(array $chat, Player $player) { $nextQueued = $this->maniaControl->mapManager->mapQueue->getNextQueuedMap(); - if ($nextQueued != null) { + if ($nextQueued) { /** @var Player $requester */ $requester = $nextQueued[0]; /** @var Map $map */ diff --git a/application/core/Maps/MapList.php b/application/core/Maps/MapList.php index b92138ee..8f14a602 100644 --- a/application/core/Maps/MapList.php +++ b/application/core/Maps/MapList.php @@ -566,7 +566,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { foreach($this->mapListShown as $login => $shown) { if ($shown) { $player = $this->maniaControl->playerManager->getPlayer($login); - if ($player != null) { + if ($player) { $this->showMapList($player); } else { unset($this->mapListShown[$login]); diff --git a/application/core/Maps/MapManager.php b/application/core/Maps/MapManager.php index 0133a49e..8614123f 100644 --- a/application/core/Maps/MapManager.php +++ b/application/core/Maps/MapManager.php @@ -325,7 +325,7 @@ class MapManager implements CallbackListener { $this->fetchCurrentMap(); - if ($admin != null) { + if ($admin) { $message = '$<' . $admin->nickname . '$> shuffled the Maplist!'; $this->maniaControl->chat->sendSuccess($message); $this->maniaControl->log($message, true); @@ -619,7 +619,7 @@ class MapManager implements CallbackListener { */ private function processMapFile($file, MXMapInfo $mapInfo, $login, $update) { // Check if map is already on the server - if ($this->getMapByUid($mapInfo->uid) != null) { + if ($this->getMapByUid($mapInfo->uid)) { // Download error $this->maniaControl->chat->sendError('Map is already on the server!', $login); return; diff --git a/application/core/Maps/MapQueue.php b/application/core/Maps/MapQueue.php index 8cc6219e..8817d69b 100644 --- a/application/core/Maps/MapQueue.php +++ b/application/core/Maps/MapQueue.php @@ -151,7 +151,7 @@ class MapQueue implements CallbackListener, CommandListener { $player = $queuedMap[0]; //found player, so play this map - if ($this->maniaControl->playerManager->getPlayer($player->login) != null) { + if ($this->maniaControl->playerManager->getPlayer($player->login)) { break; } diff --git a/application/core/Players/PlayerList.php b/application/core/Players/PlayerList.php index 775d9365..27490e8f 100644 --- a/application/core/Players/PlayerList.php +++ b/application/core/Players/PlayerList.php @@ -774,7 +774,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer $this->playersListShown[$login] = false; } $player = $this->maniaControl->playerManager->getPlayer($login); - if ($player != null) { + if ($player) { $this->showPlayerList($player); } else { // if player with the open widget disconnected remove him from the shownlist diff --git a/application/core/Statistics/StatisticCollector.php b/application/core/Statistics/StatisticCollector.php index 8f276681..5cb16421 100644 --- a/application/core/Statistics/StatisticCollector.php +++ b/application/core/Statistics/StatisticCollector.php @@ -267,7 +267,7 @@ class StatisticCollector implements CallbackListener { $victim = $this->maniaControl->playerManager->getPlayer($callback[1][1][1]); if (isset($callback[1][1][0])) { $shooter = $this->maniaControl->playerManager->getPlayer($callback[1][1][0]); - if ($shooter != null) { + if ($shooter) { $this->maniaControl->statisticManager->incrementStat(self::STAT_ON_KILL, $shooter); } } @@ -308,7 +308,7 @@ class StatisticCollector implements CallbackListener { $this->maniaControl->statisticManager->incrementStat(self::STAT_ON_DEATH, $victim); if (isset($paramsObject->Event->Shooter->Login)) { $shooter = $this->maniaControl->playerManager->getPlayer($paramsObject->Event->Shooter->Login); - if ($shooter != null) { + if ($shooter) { $this->maniaControl->statisticManager->incrementStat(self::STAT_ON_KILL, $shooter); } $this->maniaControl->statisticManager->incrementStat(self::STAT_ON_KILL, $shooter); diff --git a/application/core/Update/UpdateManager.php b/application/core/Update/UpdateManager.php index 4f76514e..3557f37f 100644 --- a/application/core/Update/UpdateManager.php +++ b/application/core/Update/UpdateManager.php @@ -396,15 +396,15 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener */ private function performCoreUpdate(UpdateData $updateData, Player $player = null) { if (!$this->checkPermissions()) { - if ($player != null) { - $this->maniaControl->chat->sendError('Update failed: Incorrect Filesystem permissions!', $player->login); + if ($player) { + $this->maniaControl->chat->sendError('Update failed: Incorrect file system permissions!', $player->login); } $this->maniaControl->log('Update failed!'); return false; } if (!isset($updateData->url) && !isset($updateData->releaseDate)) { - if ($player != null) { + if ($player) { $this->maniaControl->chat->sendError('Update failed: No update Data available!', $player->login); } $this->maniaControl->log('Update failed: No update Data available!'); @@ -421,7 +421,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener $bytes = file_put_contents($updateFileName, $updateFileContent); if (!$bytes || $bytes <= 0) { trigger_error("Couldn't save Update Zip."); - if ($player != null) { + if ($player) { $this->maniaControl->chat->sendError('Update failed: Couldn\'t save Update zip!', $player->login); } return false; @@ -430,7 +430,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener $result = $zip->open($updateFileName); if ($result !== true) { trigger_error("Couldn't open Update Zip. ({$result})"); - if ($player != null) { + if ($player) { $this->maniaControl->chat->sendError('Update failed: Couldn\'t open Update zip!', $player->login); } return false; @@ -444,7 +444,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener //Set the Nightly Build Date $this->setNightlyBuildDate($updateData->releaseDate); - if ($player != null) { + if ($player) { $this->maniaControl->chat->sendSuccess('Update finished!', $player->login); } $this->maniaControl->log("Update finished!"); diff --git a/application/plugins/ServerRanking.php b/application/plugins/ServerRanking.php index 20f02f22..3fa1b35e 100644 --- a/application/plugins/ServerRanking.php +++ b/application/plugins/ServerRanking.php @@ -315,7 +315,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { $type = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MIN_RANKING_TYPE); $message = ''; - if ($rankObj != null) { + if ($rankObj) { switch($type) { case self::RANKING_TYPE_RATIOS: $kd = $this->maniaControl->statisticManager->getStatisticData(StatisticManager::SPECIAL_STAT_KD_RATIO, $player->index); @@ -426,7 +426,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener { public function showNextRank(Player $player) { $rankObject = $this->getRank($player); - if ($rankObject != null) { + if ($rankObject) { if ($rankObject->rank > 1) { $nextRank = $this->getNextRank($player); $nextPlayer = $this->maniaControl->playerManager->getPlayerByIndex($nextRank->playerIndex); diff --git a/application/plugins/WidgetPlugin.php b/application/plugins/WidgetPlugin.php index 6dde4d47..345807ca 100644 --- a/application/plugins/WidgetPlugin.php +++ b/application/plugins/WidgetPlugin.php @@ -492,7 +492,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin { $label->setText($author); $label->setTextColor("FFF"); - if ($requester != null) { + if ($requester) { $label = new Label_Text(); $frame->add($label); $label->setX(0);