注册前置分发器.

@param IURLPreDispatcher $dispatcher
@param int               $index
1825
public function registerPreDispatcher(IURLPreDispatcher $dispatcher, $index = 10) {
        $this->preDispatchers [ $index ] [] = $dispatcher;
        ksort($this->preDispatchers, SORT_NUMERIC);
    }
218571
public function subscribe(Dispatcher $dispatcher)
    {
        $dispatcher->listen(Login::class, self::class.'@login');
        $dispatcher->listen(Lockout::class, self::class.'@lockout');
        $dispatcher->listen(Registered::class, self::class.'@registered');
    }
781858
public static function site($uri = '', $protocol = null, $index = false)
    {
        // 关闭可能的计划，主机，端口，用户和其他匹配到的部分
        $path = preg_replace('~^[-a-z0-9+.]++://[^/]++/?~', '', trim($uri, '/'));

        if (preg_match('/[^\x00-\x7F]/S', $path))
        {
            // 编码所有非ASCII字符，RFC 1738标准
            $path = preg_replace_callback('~([^/]+)~', 'rawurlencode', $path);
        }

        return self::base($protocol, $index) . $path;
    }
547369
protected static function defaultDeleteHandler(
        string $index,
        UriInterface $requestUri,
        JsonApiQueryParserInterface $queryParser,
        CrudInterface $crud,
        EncoderInterface $encoder
    ): ResponseInterface {
        $validatedIndex = (string)$queryParser->parse($index)->getIdentity();
        $crud->remove($validatedIndex);

        $responses = static::defaultCreateResponses($requestUri, $encoder);
        $response  = $responses->getCodeResponse(204);

        return $response;
    }
811262
public function getIndexer($index)
    {
        if (!isset($this->chain[$index])) {
            throw new \InvalidArgumentException(sprintf("Indexer for index '%s' is not registered", $index));
        }

        return $this->chain[$index];
    }
629651
public function setDispatcherClass($dispatcher)
    {
        if (!is_string($dispatcher)) {
            $this->error->setMessage('Dispatcher class name is not string');

            return;
        }

        $this->dispatcher = $dispatcher;
    }
392878
public function removeGroup(int $index): void
    {
        unset($this->groups[$index]);
        $this->groups = array_values($this->groups);
    }
358155
public function onKernelResponse(FilterResponseEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $response = $event->getResponse();
        $request = $event->getRequest();

        // extract various info from route
        $routeName = $request->get('_route');
        $routeParts = explode('.', $routeName);
        $routeType = end($routeParts);

        $this->linkHeader = LinkHeader::fromResponse($response);

        // add common headers
        $this->addCommonHeaders($request, $response);

        // add self Link header
        $selfUrl = $this->addSelfLinkHeader($routeName, $routeType, $request);
        // dispatch this!

        // add paging Link element when applicable
        if ($routeType == 'all' && $request->attributes->get('paging')) {
            $this->generatePagingLinksHeaders($routeName, $request, $response);
        }

        // add schema link header element
        $this->generateSchemaLinkHeader($routeName, $request, $response);

        // finally set link header
        $response->headers->set(
            'Link',
            (string) $this->linkHeader
        );

        $event->setResponse($response);

        // dispatch the "selfaware" event
        $event->getRequest()->attributes->set('selfLink', $selfUrl);
        $dispatcher->dispatch('graviton.rest.response.selfaware', $event);
    }
744787
public function onAddToQueueListenerRun(AddToQueueEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $query = $event->getQuery();
        $this->database->execute($query);
    }
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;
    }
674450
public static function remove($index)
    {
        if (isset(self::$views[$index])) {
            self::$views[$index] = null;
        }
    }
1218070
public void addDispatcher(String dispatcherId) {
        addDispatcher(dispatcherId,
                Math.min((int) (Runtime.getCoresCount() * THREAD_MULTIPLIER), THREAD_MAX_COUNT));
    }
54165
public function addIndex($type, $index)
    {
        if (!isset($this->indexes[$type])) {
            $this->indexes[$type] = [];
        }

        $this->indexes[$type][] = $index;
    }
193400
public function subscribe(Dispatcher $dispatcher)
    {
        $dispatcher->listen('*.entity.created', __CLASS__.'@entityCreated');
        $dispatcher->listen('*.entity.updated', __CLASS__.'@entityUpdated');
        $dispatcher->listen('*.entity.deleted', __CLASS__.'@entityDeleted');
    }
512943
public function parent(Int $index = 1) : stdClass
    {
        return $this->_layer($this->debug, $index, $index + 1);
    }
793700
public function getDispatcher(): DispatcherInterface
    {
        if (is_null($this->dispatcher)) {
            $this->setDispatcher($this->resolve(HttpDispatcher::class));
        }

        return $this->dispatcher;
    }
526425
protected function executeLinkedAction($group, $key, $index, $id)
    {
        $executedCount = 0;
        reset($this->links[$key][$id]);
        while (isset($this->links[$key][$id]) && list($removeIndex) = each($this->links[$key][$id])) {
            if ($removeIndex > $index) {
                break;
            }
            $removeAction = $this->actions[$group][$removeIndex];
            if ($this->isActionReadyToExecute($removeAction[0], $removeAction[2])) {
                $executedCount += $this->executeAction($removeIndex, $removeAction);
                unset($this->actions[$group][$removeIndex]);
                break;
            }
        }

        return $executedCount;
    }