addDispatcher

@param   string              $name
@param   DispatcherInterface $dispatcher

@return  static
16231
public function addDispatcher($name, DispatcherInterface $dispatcher)
    {
        $name = strtolower($name);

        $dispatcher->name = $name;

        $this->dispatchers[$name] = $dispatcher;

        return $this;
    }
978120
public function registerDispatcher()
    {
        $this->app->singleton('api.dispatcher', function ($app) {
            $dispatcher = new Dispatcher(
                $app, $app['files'], $app['Dingo\Api\Routing\Router'], $app[Auth::class]
            );

            $dispatcher->setSubtype($this->config('subtype'));
            $dispatcher->setStandardsTree($this->config('standardsTree'));
            $dispatcher->setPrefix($this->config('prefix'));
            $dispatcher->setDefaultVersion($this->config('version'));
            $dispatcher->setDefaultDomain($this->config('domain'));
            $dispatcher->setDefaultFormat($this->config('defaultFormat'));

            return $dispatcher;
        });
    }
744787
public function onAddToQueueListenerRun(AddToQueueEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $query = $event->getQuery();
        $this->database->execute($query);
    }
428324
public static function customDispatcher($className, $action, $params)
    {
        $dispatcher = new self;
        $dispatcher->setClassName($className);
        $dispatcher->setAction($action);
        $dispatcher->setParams($params);

        return $dispatcher;
    }
830338
public function setEventDispatcher(EventDispatcherInterface $eventDispatcher)
	{
		$this->eventDispatcher = $eventDispatcher;
		$this->twig->setEventDispatcher($eventDispatcher);
	}
858888
public void addDispatcher(String dispatcherId) {
        addDispatcher(dispatcherId, new ActorDispatcher(dispatcherId, this, Runtime.getRuntime().availableProcessors()));
    }
191529
public function registerSubscriptions(EventDispatcher $dispatcher)
    {
        if ($this->registered) {
            throw new \RuntimeException('Cannot register debug toolbar subscriptions when already registered.');
        }

        foreach ($this->toolbar->getExtensions() as $extension) {
            if ( ! $extension instanceof EventSubscriberInterface) {
                continue;
            }

            $dispatcher->addSubscriber($extension);
        }

        $this->registered = true;
    }
147755
public static function dispatcher($name)
	{
		static $all = [];

		if(! isset($all[$name]))
		{
			// system has been installed
			// use default mode
			if(Helper::isSystemInstall())
			{
				$cache = new Cache($name, 'events');

				if( $cache->ready() )
				{
					$data = $cache->import();
				}
				else
				{
					$event = new EventFactory($name);
					if( $event->load() === false )
					{
						throw new NotFoundException("Event '{$name}' is not registered in system");
					}

					$data = $event->getContentData();
					if(! $cache->export($data))
					{
						throw new WriteException("Can't write cache data for the '{$name}' event");
					}
				}
			}
			else
			{
				$data = (new EventFactory($name))->getContentData();
			}

			$manager = new Dispatcher(
				$data["name"],
				$data["completable"],
				function (Dispatcher $manager) use ($data) {
					foreach($data["classes"] as $class_name)
					{
						/** @var \EApp\Event\Interfaces\EventPrepareInterface $class */
						$class = new $class_name($data["name"]);
						$class->prepare($manager);
					}
				});

			$all[$name] = $manager;
		}

		return $all[$name];
	}
362272
public function updateModuleHookPosition(UpdatePositionEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $this->genericUpdatePosition(ModuleHookQuery::create(), $event, $dispatcher);
        $this->cacheClear($dispatcher);

        return $event;
    }
278171
protected function getDispatcher(): IDispatcher
    {
        if ($this->dispatcher === null) {
            $this->dispatcher = new Dispatcher();
        }

        return $this->dispatcher;
    }
675084
public function getErrorsDispatcher() {
		if(!$this->errorsDispatcher) {
			$this->errorsDispatcher = new Dispatcher\Errors($this, $this->getDumper());
		}
		return $this->errorsDispatcher;
	}
101813
public function create(MessageCreateEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $message = new MessageModel();

        $message
            ->setDispatcher($dispatcher)

            ->setName($event->getMessageName())
            ->setLocale($event->getLocale())
            ->setTitle($event->getTitle())
            ->setSecured($event->getSecured())

            ->save()
        ;

        $event->setMessage($message);
    }
808713
protected function registerDispatcher()
    {
        $this->app->singleton(Dispatcher::class, function() {
            return new Dispatcher(
                $this->app->make('files'), $this->app->make('html'), $this->app->make('antares.asset.resolver'), $this->app->make('path.public')
            );
        });

        $this->app->alias(Dispatcher::class, 'antares.asset.dispatcher');
    }
127972
public function dispatcher() : FastRoute\Dispatcher
    {
        $this->setRouteClosures();
        if ($this->cacheFile !== null && file_exists($this->cacheFile)) {
            return $this->cachedDispatcher();
        }
        /**
         * @var \FastRoute\RouteCollector $routeCollector
         */
        $routeCollector = new FastRoute\RouteCollector(
            new FastRoute\RouteParser\Std,
            new FastRoute\DataGenerator\GroupCountBased
        );
        $this->addRoutes($routeCollector);
        $this->createCachedRoute($routeCollector);
        return new FastRoute\Dispatcher\GroupCountBased($routeCollector->getData());
    }
647763
public function onAddToQueueListenerLoadOldData(AddToQueueEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $table          = $event->getQueueTable();
        $srctable       = $event->getSrctable();
        $srcid          = $event->getSrcid();
        $query          = "INSERT INTO $table SET ";

        if ($srctable && $srcid) {
            $loadQuery  = "SELECT * FROM $table WHERE srctable = '$srctable' AND srcid = $srcid";
            $loadQuery .= " AND startworking = 0 AND endworking = 0";
            $loadResult = $this->database->execute($loadQuery);

            if ($loadResult->numRows) {
                $event->setOldData($loadResult);
            }
        }

        $event->setQuery($query);
    }
1254375
public function onKernelRequest(GetResponseEvent $event, $name, EventDispatcherInterface $dispatcher)
    {
        $restEvent = $this->getEventObject($event);
        if ($restEvent instanceof RestEvent) {
            $dispatcher->dispatch("graviton.rest.request", $restEvent);
        }
    }
1140423
public function addCommandHandler(CommandHandlerInterface $commandHandler, string $payloadName): CommandDispatcher
    {
        $this->commandHandlers[$payloadName] = $commandHandler;

        return $this;
    }