trace.html.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <div class="trace-line-header break-long-words <?= $trace['file'] ? 'sf-toggle' : ''; ?>" data-toggle-selector="#trace-html-<?= $prefix; ?>-<?= $i; ?>" data-toggle-initial="<?= 'expanded' === $style ? 'display' : ''; ?>">
  2. <?php if ($trace['file']) { ?>
  3. <span class="icon icon-close"><?= $this->include('assets/images/icon-minus-square.svg'); ?></span>
  4. <span class="icon icon-open"><?= $this->include('assets/images/icon-plus-square.svg'); ?></span>
  5. <?php } ?>
  6. <?php if ('compact' !== $style && $trace['function']) { ?>
  7. <span class="trace-class"><?= $this->abbrClass($trace['class']); ?></span><?php if ($trace['type']) { ?><span class="trace-type"><?= $trace['type']; ?></span><?php } ?><span class="trace-method"><?= $trace['function']; ?></span><?php if (isset($trace['args'])) { ?><span class="trace-arguments">(<?= $this->formatArgs($trace['args']); ?>)</span><?php } ?>
  8. <?php } ?>
  9. <?php if ($trace['file']) { ?>
  10. <?php
  11. $lineNumber = $trace['line'] ?: 1;
  12. $fileLink = $this->getFileLink($trace['file'], $lineNumber);
  13. $filePath = strtr(strip_tags($this->formatFile($trace['file'], $lineNumber)), [' at line '.$lineNumber => '']);
  14. $filePathParts = explode(\DIRECTORY_SEPARATOR, $filePath);
  15. ?>
  16. <span class="block trace-file-path">
  17. in
  18. <a href="<?= $fileLink; ?>">
  19. <?= implode(\DIRECTORY_SEPARATOR, array_slice($filePathParts, 0, -1)).\DIRECTORY_SEPARATOR; ?><strong><?= end($filePathParts); ?></strong>
  20. </a>
  21. <?php if ('compact' === $style && $trace['function']) { ?>
  22. <span class="trace-type"><?= $trace['type']; ?></span>
  23. <span class="trace-method"><?= $trace['function']; ?></span>
  24. <?php } ?>
  25. (line <?= $lineNumber; ?>)
  26. </span>
  27. <?php } ?>
  28. </div>
  29. <?php if ($trace['file']) { ?>
  30. <div id="trace-html-<?= $prefix.'-'.$i; ?>" class="trace-code sf-toggle-content">
  31. <?= strtr($this->fileExcerpt($trace['file'], $trace['line'], 5), [
  32. '#DD0000' => 'var(--highlight-string)',
  33. '#007700' => 'var(--highlight-keyword)',
  34. '#0000BB' => 'var(--highlight-default)',
  35. '#FF8000' => 'var(--highlight-comment)',
  36. ]); ?>
  37. </div>
  38. <?php } ?>