From 8c81adc8e83969e90b4c54daf4a396b1094134ff Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Thu, 31 Aug 2017 17:30:54 +0200 Subject: Implemented container --- includes/engelsystem_provider.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'includes/engelsystem_provider.php') diff --git a/includes/engelsystem_provider.php b/includes/engelsystem_provider.php index aed331d4..f3c161a6 100644 --- a/includes/engelsystem_provider.php +++ b/includes/engelsystem_provider.php @@ -1,11 +1,13 @@ instance('container', $container); +$container->instance(ContainerInterface::class, $container); + + /** * Load configuration */ $config = new Config(); -Config::setInstance($config); +$container->instance('config', $config); $config->set(require __DIR__ . '/../config/config.default.php'); if (file_exists(__DIR__ . '/../config/config.php')) { @@ -37,7 +48,8 @@ date_default_timezone_set($config->get('timezone')); * @var Request $request */ $request = Request::createFromGlobals(); -$request::setInstance($request); +$container->instance('request', $request); + /** * Check for maintenance @@ -52,14 +64,15 @@ if ($config->get('maintenance')) { * Initialize renderer */ $renderer = new Renderer(); +$container->instance('renderer', $renderer); $renderer->addRenderer(new HtmlEngine()); -Renderer::setInstance($renderer); /** * Register error handler */ $errorHandler = new ExceptionHandler(); +$container->instance('error.handler', $errorHandler); if (config('environment') == 'development') { $errorHandler->setEnvironment(ExceptionHandler::ENV_DEVELOPMENT); ini_set('display_errors', true); @@ -171,6 +184,7 @@ foreach ($includeFiles as $file) { * Init application */ $session = new Session(); +$container->instance('session', $session); $session->start(); $request->setSession($session); -- cgit v1.2.3-70-g09d2