mirror of
https://github.com/flextype/flextype.git
synced 2025-08-09 14:46:53 +02:00
Flextype: new method setErrorHandler() added
This commit is contained in:
@@ -86,10 +86,8 @@ class Flextype
|
||||
function_exists('mb_regex_encoding') and mb_regex_encoding(Registry::get('site.charset'));
|
||||
function_exists('mb_internal_encoding') and mb_internal_encoding(Registry::get('site.charset'));
|
||||
|
||||
// Set Error handler
|
||||
set_error_handler('Flextype\Component\ErrorHandler\ErrorHandler::error');
|
||||
register_shutdown_function('Flextype\Component\ErrorHandler\ErrorHandler::fatal');
|
||||
set_exception_handler('Flextype\Component\ErrorHandler\ErrorHandler::exception');
|
||||
// Set error handler
|
||||
Flextype::setErrorHandler();
|
||||
|
||||
// Set default timezone
|
||||
date_default_timezone_set(Registry::get('site.timezone'));
|
||||
@@ -113,6 +111,23 @@ class Flextype
|
||||
ob_end_flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set error handler
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected static function setErrorHandler()
|
||||
{
|
||||
// Create directory for logs
|
||||
!Filesystem::fileExists(LOGS_PATH) and Filesystem::createDir(LOGS_PATH);
|
||||
|
||||
// Set Error handler
|
||||
set_error_handler('Flextype\Component\ErrorHandler\ErrorHandler::error');
|
||||
register_shutdown_function('Flextype\Component\ErrorHandler\ErrorHandler::fatal');
|
||||
set_exception_handler('Flextype\Component\ErrorHandler\ErrorHandler::exception');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Flextype instance.
|
||||
* Create it if it's not already created.
|
||||
|
Reference in New Issue
Block a user