mirror of
https://github.com/filp/whoops.git
synced 2026-09-11 10:16:25 +00:00
Minor tweaks to listing of frames.
This commit is contained in:
@@ -33,11 +33,19 @@ class Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $shortened
|
||||
* @return string|null
|
||||
*/
|
||||
public function getFile()
|
||||
public function getFile($shortened = false)
|
||||
{
|
||||
return !empty($this->frame['file']) ? $this->frame['file'] : null;
|
||||
$file = !empty($this->frame['file']) ? $this->frame['file'] : null;
|
||||
if ($shortened) {
|
||||
// Replace the part of the path that all frames have in common, and add 'soft hyphens' for smoother line-breaks.
|
||||
$dirname = dirname(dirname(dirname(dirname(dirname(dirname(__DIR__))))));
|
||||
$file = str_replace($dirname, "…", $file);
|
||||
$file = str_replace("/", "/­", $file);
|
||||
}
|
||||
return $file;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
</div>
|
||||
|
||||
<span class="frame-file">
|
||||
<?php echo $e($frame->getFile() ?: '<#unknown>') ?><!--
|
||||
<?php echo ($frame->getFile() ?: '<#unknown>') ?><!--
|
||||
--><span class="frame-line"><?php echo (int) $frame->getLine() ?></span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user