public static function getDefinitionEventContainer(CompilerExtension $compilerExtension, $indexConfig = 'events'): array
    {
        $builder = $compilerExtension->getContainerBuilder();
        $config = $compilerExtension->getConfig();

        $events = [];
        foreach ($config[$indexConfig] as $index => $event) {
            // get name from event/statement
            $name = $event;
            if ($event instanceof Statement) {
                $name = $event->getEntity();
            }

            // get part name
            $exp = explode('\\', $name);
            if (count($exp) > 1) {
                $name = $exp[count($exp) - 1];  // get last index
            }

            $definitionName = $compilerExtension->prefix($name);
            if (!$builder->hasDefinition($definitionName)) {
                $events[$index] = $builder->addDefinition($compilerExtension->prefix($name))
                    ->setFactory($event)
                    ->setAutowired($config['autowired']);
            } else {
                $events[$index] = $builder->getDefinition($definitionName);
            }
        }
        return $events;
    }
public static function getDefinitionEventContainer(CompilerExtension $compilerExtension, $indexConfig = 'events'): array
    {
        $builder = $compilerExtension->getContainerBuilder();
        $config = $compilerExtension->getConfig();

        $events = [];
        foreach ($config[$indexConfig] as $index => $event) {
            // get name from event/statement
            $name = $event;
            if ($event instanceof Statement) {
                $name = $event->getEntity();
            }

            // get part name
            $exp = explode('\\', $name);
            if (count($exp) > 1) {
                $name = $exp[count($exp) - 1];  // get last index
            }

            $definitionName = $compilerExtension->prefix($name);
            if (!$builder->hasDefinition($definitionName)) {
                $events[$index] = $builder->addDefinition($compilerExtension->prefix($name))
                    ->setFactory($event)
                    ->setAutowired($config['autowired']);
            } else {
                $events[$index] = $builder->getDefinition($definitionName);
            }
        }
        return $events;
    }
public static function getDefinitionEventContainer ( CompilerExtension $ compilerExtension , $ indexConfig = 'events' ) : array { $ builder = $ compilerExtension -> getContainerBuilder ( ) ; $ config = $ compilerExtension -> getConfig ( ) ; $ events = [ ] ; foreach ( $ config [ $ indexConfig ] as $ index => $ event ) { // get name from event/statement $ name = $ event ; if ( $ event instanceof Statement ) { $ name = $ event -> getEntity ( ) ; } // get part name $ exp = explode ( '\\' , $ name ) ; if ( count ( $ exp ) > 1 ) { $ name = $ exp [ count ( $ exp ) - 1 ] ; // get last index } $ definitionName = $ compilerExtension -> prefix ( $ name ) ; if ( ! $ builder -> hasDefinition ( $ definitionName ) ) { $ events [ $ index ] = $ builder -> addDefinition ( $ compilerExtension -> prefix ( $ name ) ) -> setFactory ( $ event ) -> setAutowired ( $ config [ 'autowired' ] ) ; } else { $ events [ $ index ] = $ builder -> getDefinition ( $ definitionName ) ; } } return $ events ; }
Get definition event container.

@param CompilerExtension $compilerExtension
@param string            $indexConfig
@return array
Get definition event container .