// Use resources from config, or instantiate the class based on mapping above. if ($config['resources'] instanceof ResourceManager) { $resources = $config['resources']; } else { if ($config['resources'] !== null && is_a($config['resources'], ResourceManager::class)) { $resourcesClass = $config['resources']; } /** @var \Bolt\Configuration\ResourceManager $resources */ $resources = new $resourcesClass($rootPath); } // Set any non-standard paths foreach ((array) $config['paths'] as $name => $path) { $resources->setPath($name, $path); } if (!file_exists($resources->getPath('web')) && $resources instanceof Composer) { BootException::earlyExceptionMissingLoaderConfig(); } /** @var \Bolt\Configuration\ResourceManager $config */ $resources->verify(); // Create the 'Bolt application' $appClass = Application::class; if ($config['application'] !== null && is_a($config['application'], Silex\Application::class, true)) { $appClass = $config['application']; } $app = new $appClass(['resources' => $resources]); // Initialize the 'Bolt application': Set up all routes, providers, database, templating, etc.. if (method_exists($app, 'initialize')) { $app->initialize(); } return $app; });