continued ioc refactoring.

This commit is contained in:
Taylor Otwell
2011-08-26 21:42:04 -05:00
parent fb3a0df0dd
commit 1e49001dfc
44 changed files with 1388 additions and 1046 deletions

View File

@@ -11,13 +11,6 @@ class Examiner {
*/
public $exception;
/**
* The file manager instance.
*
* @var File
*/
private $file;
/**
* Human-readable error levels and descriptions.
*
@@ -43,13 +36,11 @@ class Examiner {
* Create a new exception examiner instance.
*
* @param Exception $exception
* @param File $file
* @return void
*/
public function __construct($exception, File $file)
public function __construct($exception)
{
$this->exception = $exception;
$this->file = $file;
}
/**
@@ -89,7 +80,19 @@ class Examiner {
*/
public function context()
{
return $this->file->snapshot($this->exception->getFile(), $this->exception->getLine());
list($path, $line) = array($this->exception->getFile(), $this->exception->getLine());
if ( ! file_exists($path)) return array();
$file = file($path, FILE_IGNORE_NEW_LINES);
array_unshift($file, '');
$start = $line - 5;
$length = ($line - $start) + 5 + 1;
return array_slice($file, ($start > 0) ? $start : 0, ($length > 0) ? $length : 0, true);
}
/**