code refactoring
- improved comparing & checking - improved string composition
This commit is contained in:
@@ -127,7 +127,7 @@ class CommandManager implements CallbackListener {
|
||||
$removed = false;
|
||||
foreach ($listenerArray as &$listeners) {
|
||||
foreach ($listeners as $key => &$listenerCallback) {
|
||||
if ($listenerCallback[0] == $listener) {
|
||||
if ($listenerCallback[0] === $listener) {
|
||||
unset($listeners[$key]);
|
||||
$removed = true;
|
||||
}
|
||||
@@ -162,11 +162,11 @@ class CommandManager implements CallbackListener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (substr($message, 0, 2) == '//' || $command == 'admin') {
|
||||
if (substr($message, 0, 2) === '//' || $command === 'admin') {
|
||||
// Admin command
|
||||
$commandListeners = $this->adminCommandListeners;
|
||||
|
||||
if ($command == 'admin') {
|
||||
if ($command === 'admin') {
|
||||
// Strip 'admin' keyword
|
||||
if (isset($commandArray[1])) {
|
||||
$command = $commandArray[1];
|
||||
|
@@ -60,7 +60,7 @@ class HelpManager implements CommandListener, CallbackListener {
|
||||
$showCommands = array();
|
||||
$registeredMethods = array();
|
||||
foreach (array_reverse($this->adminCommands) as $command) {
|
||||
if (array_key_exists($command['Method'], $registeredMethods) && $showCommands[$registeredMethods[$command['Method']]]['Description'] == $command['Description']) {
|
||||
if (array_key_exists($command['Method'], $registeredMethods) && $showCommands[$registeredMethods[$command['Method']]]['Description'] === $command['Description']) {
|
||||
$name = $registeredMethods[$command['Method']];
|
||||
$showCommands[$name]['Name'] .= '|' . $command['Name'];
|
||||
} else {
|
||||
@@ -91,7 +91,7 @@ class HelpManager implements CommandListener, CallbackListener {
|
||||
$showCommands = array();
|
||||
$registeredMethods = array();
|
||||
foreach (array_reverse($this->playerCommands) as $command) {
|
||||
if (array_key_exists($command['Method'], $registeredMethods) && $showCommands[$registeredMethods[$command['Method']]]['Description'] == $command['Description']) {
|
||||
if (array_key_exists($command['Method'], $registeredMethods) && $showCommands[$registeredMethods[$command['Method']]]['Description'] === $command['Description']) {
|
||||
$name = $registeredMethods[$command['Method']];
|
||||
$showCommands[$name]['Name'] .= '|' . $command['Name'];
|
||||
} else {
|
||||
@@ -133,7 +133,7 @@ class HelpManager implements CommandListener, CallbackListener {
|
||||
$registeredMethods = array();
|
||||
foreach (array_reverse($commands) as $command) {
|
||||
if (array_key_exists($command['Method'], $registeredMethods)) {
|
||||
if ($showCommands[$registeredMethods[$command['Method']]]['Description'] == $command['Description']) {
|
||||
if ($showCommands[$registeredMethods[$command['Method']]]['Description'] === $command['Description']) {
|
||||
$name = $registeredMethods[$command['Method']];
|
||||
$showCommands[$name]['Name'] .= '|' . $command['Name'];
|
||||
} else {
|
||||
@@ -204,7 +204,7 @@ class HelpManager implements CommandListener, CallbackListener {
|
||||
$pageFrame->add($playerFrame);
|
||||
$playerFrame->setY($y);
|
||||
|
||||
if ($i % 2 != 0) {
|
||||
if ($i % 2 !== 0) {
|
||||
$lineQuad = new Quad_BgsPlayerCard();
|
||||
$playerFrame->add($lineQuad);
|
||||
$lineQuad->setSize($width, 4);
|
||||
|
Reference in New Issue
Block a user