refactoring for dependency injection and testability.
This commit is contained in:
@@ -11,6 +11,13 @@ class Examiner {
|
||||
*/
|
||||
public $exception;
|
||||
|
||||
/**
|
||||
* The file manager instance.
|
||||
*
|
||||
* @var File
|
||||
*/
|
||||
private $file;
|
||||
|
||||
/**
|
||||
* Human-readable error levels and descriptions.
|
||||
*
|
||||
@@ -35,12 +42,14 @@ class Examiner {
|
||||
/**
|
||||
* Create a new exception examiner instance.
|
||||
*
|
||||
* @param Exception $e
|
||||
* @param Exception $exception
|
||||
* @param File $file
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($e)
|
||||
public function __construct($exception, File $file)
|
||||
{
|
||||
$this->exception = $e;
|
||||
$this->exception = $exception;
|
||||
$this->file = $file;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,7 +89,7 @@ class Examiner {
|
||||
*/
|
||||
public function context()
|
||||
{
|
||||
return File::snapshot($this->exception->getFile(), $this->exception->getLine());
|
||||
return $this->file->snapshot($this->exception->getFile(), $this->exception->getLine());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user