Add another frame to example.php, fix frame code clamp

This commit is contained in:
filp
2013-03-13 13:38:55 +00:00
parent b1d252c92a
commit 2e80b84fd7
3 changed files with 12 additions and 5 deletions
+6 -3
View File
@@ -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();
+5 -1
View File
@@ -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;
+1 -1
View File
@@ -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);
?>