public function run()
    {
        // Define a custom error handler so we can log PHP errors
        set_error_handler([\Kotori\Core\Handle::class, 'error']);
        set_exception_handler([\Kotori\Core\Handle::class, 'exception']);
        register_shutdown_function([\Kotori\Core\Handle::class, 'end']);

        Container::get('config')->initialize($this->config);
        Middleware::register('before_app');

        ini_set('date.timezone', Container::get('config')->get('time_zone'));

        // Load application's common functions
        Helper::import(Container::get('config')->get('app_full_path') . '/common.php');

        // @codingStandardsIgnoreStart
        if (function_exists('spl_autoload_register')) {
            spl_autoload_register(['\\Kotori\\Core\\Helper', 'autoload']);
        } else {
            function __autoload($className)
            {
                Helper::autoload($className);
            }
        }
        // @codingStandardsIgnoreEnd

        // Init session
        Container::get('request')->sessionInit();

        Middleware::register('after_app');
        // Load route class
        Container::get('route')->dispatch();
    }