public static function Kint_Decorators_Plain::decorateTrace in Devel 8
Same name and namespace in other branches
- 8.2 kint/kint/decorators/plain.php \Kint_Decorators_Plain::decorateTrace()
File
- kint/
kint/ decorators/ plain.php, line 87
Class
Code
public static function decorateTrace($traceData) {
$output = self::_title('TRACE');
$lastStep = count($traceData);
foreach ($traceData as $stepNo => $step) {
$title = str_pad(++$stepNo . ': ', 4, ' ');
$title .= self::_colorize(isset($step['file']) ? self::_buildCalleeString($step) : 'PHP internal call', 'title');
if (!empty($step['function'])) {
$title .= ' ' . $step['function'];
if (isset($step['args'])) {
$title .= '(';
if (empty($step['args'])) {
$title .= ')';
}
else {
}
$title .= PHP_EOL;
}
}
$output .= $title;
if (!empty($step['args'])) {
$appendDollar = $step['function'] === '{closure}' ? '' : '$';
$i = 0;
foreach ($step['args'] as $name => $argument) {
$argument = kintParser::factory($argument, $name ? $appendDollar . $name : '#' . ++$i);
$argument->operator = $name ? ' =' : ':';
$maxLevels = Kint::$maxLevels;
if ($maxLevels) {
Kint::$maxLevels = $maxLevels + 2;
}
$output .= self::decorate($argument, 2);
if ($maxLevels) {
Kint::$maxLevels = $maxLevels;
}
}
$output .= ' )' . PHP_EOL;
}
if (!empty($step['object'])) {
$output .= self::_colorize(' ' . self::_char('─', 27) . ' Callee object ' . self::_char('─', 34), 'title');
$maxLevels = Kint::$maxLevels;
if ($maxLevels) {
# in cli the terminal window is filled too quickly to display huge objects
Kint::$maxLevels = Kint::enabled() === Kint::MODE_CLI ? 1 : $maxLevels + 1;
}
$output .= self::decorate(kintParser::factory($step['object']), 1);
if ($maxLevels) {
Kint::$maxLevels = $maxLevels;
}
}
if ($stepNo !== $lastStep) {
$output .= self::_colorize(self::_char('─', 80), 'title');
}
}
return $output;
}