|
|
@@ -200,7 +200,7 @@ class DBG {
|
|
|
public static function nicePrint($variable, $varName, $params = []) {
|
|
|
$col = ['green'=>'#96c178', 'red'=>'#de6b74', 'blue'=>'#55b5c1', 'bg-dark'=>'#282c34', 'white'=>'#abb2bf', 'orange'=>'#d19a66', 'violet'=>'#c476db'];
|
|
|
if (is_scalar($variable)) {
|
|
|
- $outLines = [ substr((string)$variable, 0, 20) . (strlen((string)$variable) > 20 ? '...' : '' ), $variable ];
|
|
|
+ $outLines = [ V::strShort((string)$variable, 20), $variable ];
|
|
|
} else {
|
|
|
$cnt = '';
|
|
|
ob_start();
|
|
|
@@ -209,6 +209,7 @@ class DBG {
|
|
|
|
|
|
$outLines = array();
|
|
|
$lines = explode("\n", $cnt);
|
|
|
+ $firstLine = $lines[0];
|
|
|
foreach ($lines as $line) {
|
|
|
if ('(' == trim($line)) continue;
|
|
|
if (')' == trim($line)) continue;
|
|
|
@@ -229,10 +230,13 @@ class DBG {
|
|
|
$outLines[] = $line;
|
|
|
}
|
|
|
}
|
|
|
- if ($varName) $outLines[0] = '<b style="color:'.$col['red'].'">' . $varName . "</b> => {$outLines[0]}";
|
|
|
$maxHeight = V::get('maxHeight', '400px', $params);
|
|
|
echo UI::h('details', ['style'=>"max-width:800px"], [
|
|
|
- UI::h('summary', ['style'=>"padding:3px 8px;border:1px solid #ccc;background-color:{$col['bg-dark']};color:{$col['white']};font-size:small"], array_shift($outLines)),
|
|
|
+ UI::h('summary', ['style'=>"padding:3px 8px;border:1px solid #ccc;background-color:{$col['bg-dark']};color:{$col['white']};font-size:small"],
|
|
|
+ ($varName)
|
|
|
+ ? '<b style="color:'.$col['red'].'">' . $varName . "</b> => " . htmlspecialchars(V::strShort($firstLine, 20))
|
|
|
+ : htmlspecialchars(V::strShort($firstLine, 20))
|
|
|
+ ),
|
|
|
UI::h('pre', [
|
|
|
'style' => implode(";", [
|
|
|
'background-color:'.$col['bg-dark'],
|