src/Application.php
protected function init() {
        $this->container->set('logger', function($c) {
            $configuration = $c->get('configuration');

            $logger = new Logger($configuration['logger']);

            return $logger;
        });

        $this->container->set(MiddlewareFactory::class, function($c) {
            return new MiddlewareFactory();
        });

        $this->container->set('request', function($c) {
            $psr17Factory = new Psr17Factory();

            $creator = new ServerRequestCreator(
                $psr17Factory, // ServerRequestFactory
                $psr17Factory, // UriFactory
                $psr17Factory, // UploadedFileFactory
                $psr17Factory  // StreamFactory
            );

            return $creator->fromGlobals();
        });

        $this->container->set('router', function($c) {
            return new Router();
        });

        $this->container->set('response', function($c) {
            return new Response();
        });

        $this->container->set('view', function($c) {
            $configuration = $c->get('configuration')['view'];
            $viewFunctions = isset($configuration['viewFunctions']) ? $configuration['viewFunctions'] : [];
            return new Plates($configuration['viewPath'], $viewFunctions);
        });

        $this->registerErrorHandler();
    }
protected function init() {
        $this->container->set('logger', function($c) {
            $configuration = $c->get('configuration');

            $logger = new Logger($configuration['logger']);

            return $logger;
        });

        $this->container->set(MiddlewareFactory::class, function($c) {
            return new MiddlewareFactory();
        });

        $this->container->set('request', function($c) {
            $psr17Factory = new Psr17Factory();

            $creator = new ServerRequestCreator(
                $psr17Factory, // ServerRequestFactory
                $psr17Factory, // UriFactory
                $psr17Factory, // UploadedFileFactory
                $psr17Factory  // StreamFactory
            );

            return $creator->fromGlobals();
        });

        $this->container->set('router', function($c) {
            return new Router();
        });

        $this->container->set('response', function($c) {
            return new Response();
        });

        $this->container->set('view', function($c) {
            $configuration = $c->get('configuration')['view'];
            $viewFunctions = isset($configuration['viewFunctions']) ? $configuration['viewFunctions'] : [];
            return new Plates($configuration['viewPath'], $viewFunctions);
        });

        $this->registerErrorHandler();
    }
protected function init ( ) { $ this -> container -> set ( 'logger' , function ( $ c ) { $ configuration = $ c -> get ( 'configuration' ) ; $ logger = new Logger ( $ configuration [ 'logger' ] ) ; return $ logger ; } ) ; $ this -> container -> set ( MiddlewareFactory :: class , function ( $ c ) { return new MiddlewareFactory ( ) ; } ) ; $ this -> container -> set ( 'request' , function ( $ c ) { $ psr17Factory = new Psr17Factory ( ) ; $ creator = new ServerRequestCreator ( $ psr17Factory , // ServerRequestFactory $ psr17Factory , // UriFactory $ psr17Factory , // UploadedFileFactory $ psr17Factory // StreamFactory ) ; return $ creator -> fromGlobals ( ) ; } ) ; $ this -> container -> set ( 'router' , function ( $ c ) { return new Router ( ) ; } ) ; $ this -> container -> set ( 'response' , function ( $ c ) { return new Response ( ) ; } ) ; $ this -> container -> set ( 'view' , function ( $ c ) { $ configuration = $ c -> get ( 'configuration' ) [ 'view' ] ; $ viewFunctions = isset ( $ configuration [ 'viewFunctions' ] ) ? $ configuration [ 'viewFunctions' ] : [ ] ; return new Plates ( $ configuration [ 'viewPath' ] , $ viewFunctions ) ; } ) ; $ this -> registerErrorHandler ( ) ; }
Initializes application's components
Initializes application s components