Improve type-safety
This commit is contained in:
parent
37b6c6f7ac
commit
e691f517f9
|
@ -94,7 +94,7 @@ class MDConsole {
|
||||||
|
|
||||||
$levelColor = self::CONSOLE_LEVEL_COLORS[$level];
|
$levelColor = self::CONSOLE_LEVEL_COLORS[$level];
|
||||||
|
|
||||||
if (empty($link))
|
if ($link === "")
|
||||||
echo sprintf("\033[1;30;" . $levelColor . "m_____\033[0m\033[0m %-20s \033[40m::\033[0m # \033[32m%+9s\033[0m \033[40m::\033[0m 📝 %-50s \033[40m::\033[0m 📅 %+20s\n", $context, $editedNo, $additionalNote, $date);
|
echo sprintf("\033[1;30;" . $levelColor . "m_____\033[0m\033[0m %-20s \033[40m::\033[0m # \033[32m%+9s\033[0m \033[40m::\033[0m 📝 %-50s \033[40m::\033[0m 📅 %+20s\n", $context, $editedNo, $additionalNote, $date);
|
||||||
else
|
else
|
||||||
echo sprintf("\033[1;30;" . $levelColor . "m_____\033[0m\033[0m %-20s \033[40m::\033[0m # \033[32m%+9s\033[0m \033[40m::\033[0m 📝 %-50s \033[40m::\033[0m 📅 %+20s \033[40m::\033[0m $link\n", $context, $editedNo, $additionalNote, $date);;
|
echo sprintf("\033[1;30;" . $levelColor . "m_____\033[0m\033[0m %-20s \033[40m::\033[0m # \033[32m%+9s\033[0m \033[40m::\033[0m 📝 %-50s \033[40m::\033[0m 📅 %+20s \033[40m::\033[0m $link\n", $context, $editedNo, $additionalNote, $date);;
|
||||||
|
@ -109,7 +109,7 @@ class MDConsole {
|
||||||
final public static function setupCLI():void {
|
final public static function setupCLI():void {
|
||||||
|
|
||||||
$startTime = microtime(true);
|
$startTime = microtime(true);
|
||||||
register_shutdown_function(function($startTime) {
|
register_shutdown_function(function($startTime):void {
|
||||||
|
|
||||||
$duration = microtime(true) - $startTime;
|
$duration = microtime(true) - $startTime;
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ class MDOutputHandler {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->_context)) $contextStr = "{$this->_context} │ ";
|
if ($this->_context !== "") $contextStr = "{$this->_context} │ ";
|
||||||
else $contextStr = "";
|
else $contextStr = "";
|
||||||
|
|
||||||
// Generate the message to log.
|
// Generate the message to log.
|
||||||
|
@ -136,7 +136,7 @@ class MDOutputHandler {
|
||||||
file_put_contents($this->_logfile, $message, FILE_APPEND);
|
file_put_contents($this->_logfile, $message, FILE_APPEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($this->_verbosity > 0 && in_array($statusCode, [MDConsole::STATUS_UPDATE, MDConsole::STATUS_DELETION, MDConsole::STATUS_ERROR])) || $this->_verbosity === 2) echo $message;
|
if (($this->_verbosity > 0 && in_array($statusCode, [MDConsole::STATUS_UPDATE, MDConsole::STATUS_DELETION, MDConsole::STATUS_ERROR], true)) || $this->_verbosity === 2) echo $message;
|
||||||
|
|
||||||
if ($this->_counter % 250 === 0) {
|
if ($this->_counter % 250 === 0) {
|
||||||
echo '―――> ' . sprintf("%1$07d", $this->_counter) . " operations processed" . PHP_EOL;
|
echo '―――> ' . sprintf("%1$07d", $this->_counter) . " operations processed" . PHP_EOL;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user