mirror of
https://github.com/filp/whoops.git
synced 2026-09-18 05:36:21 +00:00
Add another frame to example.php, fix frame code clamp
This commit is contained in:
+6
-3
@@ -16,15 +16,18 @@ require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
use Damnit\Run;
|
||||
use Damnit\Handler\PrettyPage;
|
||||
use Damnit\Handler\Handler;
|
||||
|
||||
$run = new Run;
|
||||
$run->pushHandler(new PrettyPage);
|
||||
$run->register();
|
||||
|
||||
|
||||
function fooBar() {
|
||||
throw new RuntimeException("hello, world!");
|
||||
}
|
||||
|
||||
fooBar();
|
||||
function bar()
|
||||
{
|
||||
fooBar();
|
||||
}
|
||||
|
||||
bar();
|
||||
|
||||
@@ -111,7 +111,11 @@ class Frame
|
||||
);
|
||||
}
|
||||
|
||||
$lines = array_slice($lines, $start, $end, true);
|
||||
// Clamp the range to the number of lines:
|
||||
$start = max(0, $start);
|
||||
$end = min(count($lines)-1, $end);
|
||||
|
||||
$lines = array_slice($lines, $start, $end - $start, true);
|
||||
}
|
||||
|
||||
return $lines;
|
||||
|
||||
@@ -215,7 +215,7 @@
|
||||
$line = $frame->getLine();
|
||||
|
||||
// the $line is 1-indexed, we nab -1 where needed to account for this
|
||||
$range = $frame->getFileLines($line - 4, $line);
|
||||
$range = $frame->getFileLines($line - 3, $line + 3);
|
||||
$start = key($range) + 1;
|
||||
$code = join("\n", $range);
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user