Minor tweaks to listing of frames.

This commit is contained in:
Bob den Otter
2013-04-06 15:49:51 +02:00
parent 2b8d954eba
commit fc486e3f7a
2 changed files with 11 additions and 3 deletions
+10 -2
View File
@@ -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;
}
/**
+1 -1
View 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>