src/Application.php
private function bootstrap()
    {
        // Attach the error handler - all PHP Errors should be thrown as Exceptions
        ErrorInterceptor::registerErrorHandler();
        set_exception_handler(array(static::class, 'handleException'));

        // Set character set
        ini_set('default_charset', 'UTF-8');
        mb_internal_encoding('UTF-8');

        // Set up logging
        ini_set('log_errors', '1');

        // Load configuration
        $this->loadConfig();
        $this->injector->setInstance(Configuration::class, $this->config);

        $this->cachemanager = $this->injector->getInstance(Cache\Manager::class);
        $this->dev = $this->config->dget('site', 'dev', true);

        // Set up the autoloader
        $this->configureAutoloaderAndResolver();

        // Make sure permissions are adequate
        try
        {
            $this->path_config->checkPaths();
        }
        catch (PermissionError $e)
        {
            return $this->showPermissionError($e);
        }

        $test = defined('WEDETO_TEST') && WEDETO_TEST === 1 ? 'test' : '';
        if (PHP_SAPI === 'cli')
            ini_set('error_log', $this->path_config->log . '/error-php-cli' . $test . '.log');
        else
            ini_set('error_log', $this->path_config->log . '/error-php' . $test . '.log');

        // Set default permissions for files and directories
        $this->setCreatePermissions();

        // Autoloader requires manual logger setup to avoid depending on external files
        LoggerFactory::setLoggerFactory(new LoggerFactory());
        Autoloader::setLogger(LoggerFactory::getLogger(['class' => Autoloader::class]));

        // Set up root logger
        $this->setupLogging();

        // Save the cache if configured so
        if ($this->path_config->cache)
        {
            $this->cachemanager->setCachePath($this->path_config->cache);
            $this->cachemanager->setHook($this->config->dget('cache', 'expiry', 60));
        }

        // Find installed modules and initialize them
        $this->module_manager = new Module\Manager($this->resolver);

        // Prepare the HTTP Request Object
        $this->request = Request::createFromGlobals();

        // Load plugins
        $this->setupPlugins();
    }
private function bootstrap()
    {
        // Attach the error handler - all PHP Errors should be thrown as Exceptions
        ErrorInterceptor::registerErrorHandler();
        set_exception_handler(array(static::class, 'handleException'));

        // Set character set
        ini_set('default_charset', 'UTF-8');
        mb_internal_encoding('UTF-8');

        // Set up logging
        ini_set('log_errors', '1');

        // Load configuration
        $this->loadConfig();
        $this->injector->setInstance(Configuration::class, $this->config);

        $this->cachemanager = $this->injector->getInstance(Cache\Manager::class);
        $this->dev = $this->config->dget('site', 'dev', true);

        // Set up the autoloader
        $this->configureAutoloaderAndResolver();

        // Make sure permissions are adequate
        try
        {
            $this->path_config->checkPaths();
        }
        catch (PermissionError $e)
        {
            return $this->showPermissionError($e);
        }

        $test = defined('WEDETO_TEST') && WEDETO_TEST === 1 ? 'test' : '';
        if (PHP_SAPI === 'cli')
            ini_set('error_log', $this->path_config->log . '/error-php-cli' . $test . '.log');
        else
            ini_set('error_log', $this->path_config->log . '/error-php' . $test . '.log');

        // Set default permissions for files and directories
        $this->setCreatePermissions();

        // Autoloader requires manual logger setup to avoid depending on external files
        LoggerFactory::setLoggerFactory(new LoggerFactory());
        Autoloader::setLogger(LoggerFactory::getLogger(['class' => Autoloader::class]));

        // Set up root logger
        $this->setupLogging();

        // Save the cache if configured so
        if ($this->path_config->cache)
        {
            $this->cachemanager->setCachePath($this->path_config->cache);
            $this->cachemanager->setHook($this->config->dget('cache', 'expiry', 60));
        }

        // Find installed modules and initialize them
        $this->module_manager = new Module\Manager($this->resolver);

        // Prepare the HTTP Request Object
        $this->request = Request::createFromGlobals();

        // Load plugins
        $this->setupPlugins();
    }
Helper method to bootstrap the system - adjust PHP configuration, set up logging and autoloading