various refactoring and tweaks.

This commit is contained in:
Taylor Otwell
2011-10-20 21:44:18 -05:00
parent df9130dafa
commit af36cb3d5a
22 changed files with 140 additions and 110 deletions

View File

@@ -6,8 +6,12 @@
* error handler to create a more readable message.
*/
$message = function($e)
{
$file = str_replace(array(APP_PATH, SYS_PATH), array('APP_PATH/', 'SYS_PATH/'), $e->getFile());
{
$search = array(APP_PATH, SYS_PATH);
$replace = array('APP_PATH/', 'SYS_PATH/');
$file = str_replace($search, $replace, $e->getFile());
return rtrim($e->getMessage(), '.').' in '.$file.' on line '.$e->getLine().'.';
};
@@ -35,14 +39,23 @@ $severity = function($e)
E_STRICT => 'Runtime Notice',
);
return (array_key_exists($e->getCode(), $levels)) ? $levels[$e->getCode()] : $e->getCode();
if (array_key_exists($e->getCode(), $levels))
{
$level = $levels[$e->getCode()];
}
else
{
$level = $e->getCode();
}
return $level;
};
/**
* Create the exception handler function. All of the error handlers
* registered with PHP call this closure to keep the code D.R.Y.
* Each of the formatting closures defined above will be passed
* into the handler for convenient use.
* registered by the framework call this closure to avoid duplicate
* code. Each of the formatting closures defined above will be
* passed into the handler for convenient use.
*/
$handler = function($e) use ($message, $severity)
{