mirror of
https://github.com/filp/whoops.git
synced 2026-09-12 10:46:20 +00:00
Add initial argument output support
This commit is contained in:
@@ -111,6 +111,17 @@ class PrettyPageHandler extends Handler
|
||||
return strtolower($_);
|
||||
};
|
||||
|
||||
// $type -> translate gettype to valid prettyprint class names
|
||||
$type = function($_) {
|
||||
static $map = array(
|
||||
'string' => 'str',
|
||||
'boolean' => 'kwd',
|
||||
'object' => 'typ'
|
||||
);
|
||||
|
||||
return isset($map[$_]) ? $map[$_] : $_;
|
||||
};
|
||||
|
||||
require $templateFile;
|
||||
});
|
||||
|
||||
|
||||
@@ -159,6 +159,38 @@ header {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.frame-arguments {
|
||||
background: #404040;
|
||||
border-top: 1px solid rgba(255, 255, 255, .1);
|
||||
border-bottom: 1px solid rgba(255, 255, 255, .1);
|
||||
padding: 5px 15px;
|
||||
}
|
||||
.frame-arguments label,
|
||||
.argument-n {
|
||||
color: #B1B1B1;
|
||||
font-weight: bold;
|
||||
font-size: 11px;
|
||||
}
|
||||
.argument-n {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.frame-arguments .empty {
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
font-size: 12px;
|
||||
color: #888888;
|
||||
}
|
||||
|
||||
.frame-arguments-list {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
margin: 5px 0 0 0;
|
||||
}
|
||||
.frame-arguments-list li {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.frame-comments {
|
||||
box-shadow: inset 0 0 6px rgba(0, 0, 0, .3);
|
||||
border: 1px solid rgba(0, 0, 0, .2);
|
||||
|
||||
@@ -89,6 +89,36 @@
|
||||
<pre class="code-block prettyprint linenums:<?php echo $start ?>"><?php echo $e($code) ?></pre>
|
||||
<?php endif ?>
|
||||
|
||||
<?php
|
||||
// Append arguments for this frame/function
|
||||
$args = $frame->getArgs();
|
||||
?>
|
||||
<div class="frame-arguments <?php echo empty($args) ? 'empty' : '' ?>">
|
||||
<label>arguments:</label>
|
||||
<ul class="frame-arguments-list">
|
||||
|
||||
<?php if(empty($args)): ?>
|
||||
<li><em class="empty">empty</em></li>
|
||||
<?php else: ?>
|
||||
|
||||
<?php foreach($args as $argN => $arg): ?>
|
||||
<li class="argument">
|
||||
<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 elseif(is_object($arg)): ?>
|
||||
<<?php echo get_class($arg) ?>>
|
||||
<?php else: ?>
|
||||
<?php echo var_export($arg, true) ?>
|
||||
<?php endif ?>
|
||||
</code>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
<?php endif ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/* Append comments for this frame */
|
||||
$comments = $frame->getComments();
|
||||
|
||||
Reference in New Issue
Block a user