public function build(array $config, ContainerInterface $container = null)
    {
        $dispatcher = new Dispatcher($container);
        foreach ((array) $config as $name => $listeners) {
            foreach ($listeners as $listener) {
                if (is_callable($listener)) {
                    $dispatcher->register($name, $listener);
                    continue;
                }

                $listener = $this->applyDefaults($listener);

                $dispatcher->register(
                    $name,
                    $this->buildDefinition($listener)
                );
            }
        }

        return $dispatcher;
    }
public function build(array $config, ContainerInterface $container = null)
    {
        $dispatcher = new Dispatcher($container);
        foreach ((array) $config as $name => $listeners) {
            foreach ($listeners as $listener) {
                if (is_callable($listener)) {
                    $dispatcher->register($name, $listener);
                    continue;
                }

                $listener = $this->applyDefaults($listener);

                $dispatcher->register(
                    $name,
                    $this->buildDefinition($listener)
                );
            }
        }

        return $dispatcher;
    }
public function build ( array $ config , ContainerInterface $ container = null ) { $ dispatcher = new Dispatcher ( $ container ) ; foreach ( ( array ) $ config as $ name => $ listeners ) { foreach ( $ listeners as $ listener ) { if ( is_callable ( $ listener ) ) { $ dispatcher -> register ( $ name , $ listener ) ; continue ; } $ listener = $ this -> applyDefaults ( $ listener ) ; $ dispatcher -> register ( $ name , $ this -> buildDefinition ( $ listener ) ) ; } } return $ dispatcher ; }
Builds event dispatcher and event listeners

@param array                   $config
@param null|ContainerInterface $container

@return Dispatcher
Builds event dispatcher and event listeners