mirror of
https://github.com/filp/whoops.git
synced 2026-09-12 10:46:20 +00:00
Clamp string length in arguments list
This commit is contained in:
@@ -111,6 +111,13 @@ class PrettyPageHandler extends Handler
|
||||
return strtolower($_);
|
||||
};
|
||||
|
||||
// $clamp -> clamp a string's length to a maximum, with trailing
|
||||
// ellipsis if the size is exceeded
|
||||
$clamp = function($_, $max = 85) {
|
||||
return strlen($_) <= $max ?
|
||||
$_ : (substr($_, 0, $max - 1) . '...');
|
||||
};
|
||||
|
||||
// $type -> translate gettype to valid prettyprint class names
|
||||
$type = function($_) {
|
||||
static $map = array(
|
||||
@@ -122,6 +129,8 @@ class PrettyPageHandler extends Handler
|
||||
return isset($map[$_]) ? $map[$_] : $_;
|
||||
};
|
||||
|
||||
// $trim ->
|
||||
|
||||
require $templateFile;
|
||||
});
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
<span class="argument-n"><?php echo $argN ?></span>
|
||||
<code class="prettyprint <?php echo $type(gettype($arg)) ?>">
|
||||
<?php if(is_string($arg)): ?>
|
||||
"<?php echo $e($arg) ?>"
|
||||
"<?php echo $e($clamp($arg)) ?>"
|
||||
<?php elseif(is_object($arg)): ?>
|
||||
<<?php echo get_class($arg) ?>>
|
||||
<?php else: ?>
|
||||
|
||||
Reference in New Issue
Block a user