public function init(
        ServicesInterface $services,
        ListenersInterface $listeners,
        EventsInterface $events,
        ConfigInterface $config
    ) {
        if ($this->initialized) {
            throw new RuntimeException(
                'The components have already been initialized.'
            );
        }
        $this->initialized = true;

        foreach ($this->container as $component) {
            if (method_exists($component, 'getServicesConfig')) {
                $services->add($component->getServicesConfig());
            }
            if (method_exists($component, 'getListenersConfig')) {
                $listeners->add($component->getListenersConfig());
            }
            if (method_exists($component, 'getEventsConfig')) {
                foreach ($component->getEventsConfig() as $item) {
                    call_user_func_array([$events, 'attach'], $item);
                }
            }
            if (method_exists($component, 'getSystemConfig')) {
                $config->merge($component->getSystemConfig());
            }
        }
    }
public function init(
        ServicesInterface $services,
        ListenersInterface $listeners,
        EventsInterface $events,
        ConfigInterface $config
    ) {
        if ($this->initialized) {
            throw new RuntimeException(
                'The components have already been initialized.'
            );
        }
        $this->initialized = true;

        foreach ($this->container as $component) {
            if (method_exists($component, 'getServicesConfig')) {
                $services->add($component->getServicesConfig());
            }
            if (method_exists($component, 'getListenersConfig')) {
                $listeners->add($component->getListenersConfig());
            }
            if (method_exists($component, 'getEventsConfig')) {
                foreach ($component->getEventsConfig() as $item) {
                    call_user_func_array([$events, 'attach'], $item);
                }
            }
            if (method_exists($component, 'getSystemConfig')) {
                $config->merge($component->getSystemConfig());
            }
        }
    }
public function init ( ServicesInterface $ services , ListenersInterface $ listeners , EventsInterface $ events , ConfigInterface $ config ) { if ( $ this -> initialized ) { throw new RuntimeException ( 'The components have already been initialized.' ) ; } $ this -> initialized = true ; foreach ( $ this -> container as $ component ) { if ( method_exists ( $ component , 'getServicesConfig' ) ) { $ services -> add ( $ component -> getServicesConfig ( ) ) ; } if ( method_exists ( $ component , 'getListenersConfig' ) ) { $ listeners -> add ( $ component -> getListenersConfig ( ) ) ; } if ( method_exists ( $ component , 'getEventsConfig' ) ) { foreach ( $ component -> getEventsConfig ( ) as $ item ) { call_user_func_array ( [ $ events , 'attach' ] , $ item ) ; } } if ( method_exists ( $ component , 'getSystemConfig' ) ) { $ config -> merge ( $ component -> getSystemConfig ( ) ) ; } } }
Initializes components.

@param \Es\Services\ServicesInterface $services  The services
@param \Es\Events\ListenersInterface  $listeners The listeners
@param \Es\Events\EventsInterface     $events    The events
@param \Es\System\ConfigInterface     $config    The system configuration

@throws \RuntimeException If the components have already been initialized
Initializes components .