src/System.php
public static function init(array $config = [], $devMode = false)
    {
        if (static::$instance instanceof static) {
            return;
        }

        $system = static::$instance = new static();

        $system->devMode = (bool) $devMode;

        $services = $system->getServices();
        $services->set('System', $system);

        $items = [];
        if (isset($config['components'])) {
            $items = (array) $config['components'];
        }
        $components = $system->getComponents();
        foreach ($items as $index => $item) {
            $config['components'][$index] = $components->register($item);
        }

        $systemConfig = new SystemConfig($config);
        $services->set('Config', $systemConfig);

        $listeners = new Listeners();
        $services->set('Listeners', $listeners);

        $events = new Events();
        $services->set('Events', $events);

        $components->init($services, $listeners, $events, $systemConfig);
        $events->trigger($system->getEvent());

        return $system;
    }
public static function init(array $config = [], $devMode = false)
    {
        if (static::$instance instanceof static) {
            return;
        }

        $system = static::$instance = new static();

        $system->devMode = (bool) $devMode;

        $services = $system->getServices();
        $services->set('System', $system);

        $items = [];
        if (isset($config['components'])) {
            $items = (array) $config['components'];
        }
        $components = $system->getComponents();
        foreach ($items as $index => $item) {
            $config['components'][$index] = $components->register($item);
        }

        $systemConfig = new SystemConfig($config);
        $services->set('Config', $systemConfig);

        $listeners = new Listeners();
        $services->set('Listeners', $listeners);

        $events = new Events();
        $services->set('Events', $events);

        $components->init($services, $listeners, $events, $systemConfig);
        $events->trigger($system->getEvent());

        return $system;
    }
public static function init ( array $ config = [ ] , $ devMode = false ) { if ( static :: $ instance instanceof static ) { return ; } $ system = static :: $ instance = new static ( ) ; $ system -> devMode = ( bool ) $ devMode ; $ services = $ system -> getServices ( ) ; $ services -> set ( 'System' , $ system ) ; $ items = [ ] ; if ( isset ( $ config [ 'components' ] ) ) { $ items = ( array ) $ config [ 'components' ] ; } $ components = $ system -> getComponents ( ) ; foreach ( $ items as $ index => $ item ) { $ config [ 'components' ] [ $ index ] = $ components -> register ( $ item ) ; } $ systemConfig = new SystemConfig ( $ config ) ; $ services -> set ( 'Config' , $ systemConfig ) ; $ listeners = new Listeners ( ) ; $ services -> set ( 'Listeners' , $ listeners ) ; $ events = new Events ( ) ; $ services -> set ( 'Events' , $ events ) ; $ components -> init ( $ services , $ listeners , $ events , $ systemConfig ) ; $ events -> trigger ( $ system -> getEvent ( ) ) ; return $ system ; }
Initializes system.
Returns an instance of the system only once at initialization.

@param array $config  Optional; the system configuration
@param bool  $devMode Optional; false by default. The system mode

@return self|void Returns the instance of System only once
Initializes system . Returns an instance of the system only once at initialization .