You are here

public static function Kint_Decorators_Rich::decorateTrace in Devel 8.2

Same name and namespace in other branches
  1. 8 kint/kint/decorators/rich.php \Kint_Decorators_Rich::decorateTrace()

File

kint/kint/decorators/rich.php, line 94

Class

Kint_Decorators_Rich

Code

public static function decorateTrace($traceData) {
  $output = '<dl class="kint-trace">';
  foreach ($traceData as $i => $step) {
    $class = 'kint-parent';
    if (Kint::$expandedByDefault) {
      $class .= ' kint-show';
    }
    $output .= '<dt class="' . $class . '">' . '<b>' . ($i + 1) . '</b> ' . '<nav></nav>' . '<var>';
    if (isset($step['file'])) {
      $output .= self::_ideLink($step['file'], $step['line']);
    }
    else {
      $output .= 'PHP internal call';
    }
    $output .= '</var>';
    $output .= $step['function'];
    if (isset($step['args'])) {
      $output .= '(' . implode(', ', array_keys($step['args'])) . ')';
    }
    $output .= '</dt><dd>';
    $firstTab = ' class="kint-active-tab"';
    $output .= '<ul class="kint-tabs">';
    if (!empty($step['source'])) {
      $output .= "<li{$firstTab}>Source</li>";
      $firstTab = '';
    }
    if (!empty($step['args'])) {
      $output .= "<li{$firstTab}>Arguments</li>";
      $firstTab = '';
    }
    if (!empty($step['object'])) {
      kintParser::reset();
      $calleeDump = kintParser::factory($step['object']);
      $output .= "<li{$firstTab}>Callee object [{$calleeDump->type}]</li>";
    }
    $output .= '</ul><ul>';
    if (!empty($step['source'])) {
      $output .= "<li><pre class=\"kint-source\">{$step['source']}</pre></li>";
    }
    if (!empty($step['args'])) {
      $output .= "<li>";
      foreach ($step['args'] as $k => $arg) {
        kintParser::reset();
        $output .= self::decorate(kintParser::factory($arg, $k));
      }
      $output .= "</li>";
    }
    if (!empty($step['object'])) {
      $output .= "<li>" . self::decorate($calleeDump) . "</li>";
    }
    $output .= '</ul></dd>';
  }
  $output .= '</dl>';
  return $output;
}