1
0
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:
Awilum
2018-06-02 22:26:06 +03:00
parent e293c38183
commit 1360793ff7

View File

@@ -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.