public static function createRouteDispatcher(
        ContainerInterface $container,
        ?callable $getPrevious = null
    ): DispatcherContract {
        // @codeCoverageIgnoreStart
        if (\is_callable($getPrevious)) {
            $dispatcher = $getPrevious();
        } elseif (\class_exists(Pipeline::class)) {
            $dispatcher = new MiddlewareBasedDispatcher();
        } else {
            $dispatcher = new SimpleDispatcher();
        }
        // @codeCoverageIgnoreStop

        if ($container->has(EventManagerContract::class)) {
            $dispatcher->setEventManager($container->get(EventManagerContract::class));
        }

        return $dispatcher;
    }
public static function createRouteDispatcher(
        ContainerInterface $container,
        ?callable $getPrevious = null
    ): DispatcherContract {
        // @codeCoverageIgnoreStart
        if (\is_callable($getPrevious)) {
            $dispatcher = $getPrevious();
        } elseif (\class_exists(Pipeline::class)) {
            $dispatcher = new MiddlewareBasedDispatcher();
        } else {
            $dispatcher = new SimpleDispatcher();
        }
        // @codeCoverageIgnoreStop

        if ($container->has(EventManagerContract::class)) {
            $dispatcher->setEventManager($container->get(EventManagerContract::class));
        }

        return $dispatcher;
    }
public static function createRouteDispatcher ( ContainerInterface $ container , ? callable $ getPrevious = null ) : DispatcherContract { // @codeCoverageIgnoreStart if ( \ is_callable ( $ getPrevious ) ) { $ dispatcher = $ getPrevious ( ) ; } elseif ( \ class_exists ( Pipeline :: class ) ) { $ dispatcher = new MiddlewareBasedDispatcher ( ) ; } else { $ dispatcher = new SimpleDispatcher ( ) ; } // @codeCoverageIgnoreStop if ( $ container -> has ( EventManagerContract :: class ) ) { $ dispatcher -> setEventManager ( $ container -> get ( EventManagerContract :: class ) ) ; } return $ dispatcher ; }
Create a route dispatcher instance.

@param \Psr\Container\ContainerInterface $container
@param null|callable                     $getPrevious

@return \Viserio\Component\Contract\Routing\Dispatcher
Create a route dispatcher instance .