Skip to content

Commit a69725c

Browse files
committed
update
1 parent a5c886a commit a69725c

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/Util/Show.php

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public static function block($messages, string $type = 'MESSAGE', string $style
7979

8080
// add type
8181
if ($type) {
82-
$messages[0] = \sprintf('[%s] %s', strtoupper($type), $messages[0]);
82+
$messages[0] = \sprintf('[%s] %s', \strtoupper($type), $messages[0]);
8383
}
8484

8585
$text = \implode(\PHP_EOL, $messages);
@@ -105,22 +105,23 @@ public static function liteBlock(
105105
string $style = Style::NORMAL,
106106
$quit = false
107107
): int {
108+
$fmtType = '';
108109
$messages = \is_array($messages) ? \array_values($messages) : [$messages];
109110

110-
// add type
111-
if (null !== $type) {
112-
$type = \sprintf('[%s]', \strtoupper($type));
113-
}
114-
115111
$text = \implode(\PHP_EOL, $messages);
116112
$color = static::getStyle();
117113

118114
// add type
119-
if ($type && \is_string($style) && $color->hasStyle($style)) {
120-
$type = \sprintf('<%s>[%s]</%s> ', $style, \strtoupper($type), $style);
115+
if ($type) {
116+
$fmtType = \sprintf('[%s]', $upType = \strtoupper($type));
117+
118+
// add style
119+
if ($style && $color->hasStyle($style)) {
120+
$fmtType = \sprintf('<%s>[%s]</%s> ', $style, $upType, $style);
121+
}
121122
}
122123

123-
return self::write($type . $text, true, $quit);
124+
return self::write($fmtType . $text, true, $quit);
124125
}
125126

126127
/**
@@ -162,7 +163,9 @@ public static function __callStatic($method, array $args = [])
162163
$style = self::$blockMethods[$method];
163164

164165
if (0 === \strpos($method, 'lite')) {
165-
return self::liteBlock($msg, $style === 'primary' ? 'IMPORTANT' : $style, $style, $quit);
166+
$type = \substr($method, 4);
167+
168+
return self::liteBlock($msg, $type === 'primary' ? 'IMPORTANT' : $type, $style, $quit);
166169
}
167170

168171
return self::block($msg, $style === 'primary' ? 'IMPORTANT' : $style, $style, $quit);

0 commit comments

Comments
 (0)