diff --git a/application/core/ManiaExchange/ManiaExchangeList.php b/application/core/ManiaExchange/ManiaExchangeList.php index ca417669..c15cc68d 100644 --- a/application/core/ManiaExchange/ManiaExchangeList.php +++ b/application/core/ManiaExchange/ManiaExchangeList.php @@ -99,7 +99,7 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener } $function = function ($maps) use (&$player) { - if ($maps == null) { + if (!$maps) { $this->maniaControl->chat->sendError('No maps found, or MX is down!', $player->login); return; } diff --git a/application/core/Maps/MapQueue.php b/application/core/Maps/MapQueue.php index 8817d69b..e3ac3574 100644 --- a/application/core/Maps/MapQueue.php +++ b/application/core/Maps/MapQueue.php @@ -175,7 +175,7 @@ class MapQueue implements CallbackListener, CommandListener { $this->nextMap = array_shift($this->queuedMaps); //Check if Map Queue is empty - if ($this->nextMap == null || !isset($this->nextMap[1])) { + if (!$this->nextMap || !isset($this->nextMap[1])) { return; } $map = $this->nextMap[1]; diff --git a/application/core/Players/Player.php b/application/core/Players/Player.php index 938f36d4..0a76a3d9 100644 --- a/application/core/Players/Player.php +++ b/application/core/Players/Player.php @@ -109,7 +109,7 @@ class Player { $this->joinTime = time(); - if ($this->nickname == null || $this->nickname == '') { + if (!$this->nickname) { $this->nickname = $this->login; } } diff --git a/application/core/Players/PlayerManager.php b/application/core/Players/PlayerManager.php index 7ded34a5..a5bcee7b 100644 --- a/application/core/Players/PlayerManager.php +++ b/application/core/Players/PlayerManager.php @@ -165,16 +165,12 @@ class PlayerManager implements CallbackListener, TimerListener { public function playerDisconnect(array $callback) { $login = $callback[1][0]; $player = $this->removePlayer($login); - - if ($player == null) { - return; - } + if (!$player) return; + // Trigger own callback $this->maniaControl->callbackManager->triggerCallback(self::CB_PLAYERDISCONNECT, $player); - if ($player->isFakePlayer()) { - return; - } + if ($player->isFakePlayer()) return; $played = Formatter::formatTimeH(time() - $player->joinTime); $logMessage = "Player left: {$player->login} / {$player->nickname} Playtime: {$played}"; @@ -192,9 +188,7 @@ class PlayerManager implements CallbackListener, TimerListener { */ public function playerInfoChanged(array $callback) { $player = $this->getPlayer($callback[1][0]['Login']); - if ($player == null) { - return; - } + if (!$player) return; $player->ladderRank = $callback[1][0]["LadderRanking"]; $player->teamId = $callback[1][0]["TeamId"]; diff --git a/application/core/Statistics/StatisticManager.php b/application/core/Statistics/StatisticManager.php index 027a4afa..cfc7e6a2 100644 --- a/application/core/Statistics/StatisticManager.php +++ b/application/core/Statistics/StatisticManager.php @@ -114,9 +114,7 @@ class StatisticManager { $mysqli = $this->maniaControl->database->mysqli; $statId = $this->getStatId($statName); - if ($statId == null) { - return -1; - } + if (!$statId) return -1; if ($serverIndex == -1) { $query = "SELECT SUM(value) as value FROM `" . self::TABLE_STATISTICS . "` WHERE `statId` = " . $statId . " AND `playerId` = " . $playerId . ";"; diff --git a/application/plugins/Dedimania/DedimaniaPlayer.php b/application/plugins/Dedimania/DedimaniaPlayer.php index 93b2ca5d..34738534 100644 --- a/application/plugins/Dedimania/DedimaniaPlayer.php +++ b/application/plugins/Dedimania/DedimaniaPlayer.php @@ -15,9 +15,7 @@ class DedimaniaPlayer { public $options = ''; public function __construct($player) { - if ($player == null) { - return; - } + if (!$player) return; $this->login = $player['Login']; $this->maxRank = $player['MaxRank']; diff --git a/application/plugins/Dedimania/RecordData.php b/application/plugins/Dedimania/RecordData.php index 09f43bde..fa959930 100644 --- a/application/plugins/Dedimania/RecordData.php +++ b/application/plugins/Dedimania/RecordData.php @@ -27,7 +27,7 @@ class RecordData { * @param $record */ public function __construct($record) { - if ($record == null) { + if (!$record) { $this->nullRecord = true; return; }