protected function resolveRequestHandler(): RequestHandlerInterface
    {
        if ($this->preselectedRequestHandlerClassName !== null && isset($this->requestHandlers[$this->preselectedRequestHandlerClassName])) {
            /** @var RequestHandlerInterface $requestHandler */
            $requestHandler = $this->requestHandlers[$this->preselectedRequestHandlerClassName];
            if ($requestHandler->canHandleRequest()) {
                return $requestHandler;
            }
        }

        /** @var RequestHandlerInterface $requestHandler */
        foreach ($this->requestHandlers as $requestHandler) {
            if ($requestHandler->canHandleRequest() > 0) {
                $priority = $requestHandler->getPriority();
                if (isset($suitableRequestHandlers[$priority])) {
                    throw new FlowException('More than one request handler with the same priority can handle the request, but only one handler may be active at a time!', 1176475350);
                }
                $suitableRequestHandlers[$priority] = $requestHandler;
            }
        }
        if (empty($suitableRequestHandlers)) {
            throw new FlowException('No suitable request handler could be found for the current request. This is most likely a setup-problem, so please check your composer.json and/or try removing Configuration/PackageStates.php', 1464882543);
        }
        ksort($suitableRequestHandlers);
        return array_pop($suitableRequestHandlers);
    }
protected function resolveRequestHandler(): RequestHandlerInterface
    {
        if ($this->preselectedRequestHandlerClassName !== null && isset($this->requestHandlers[$this->preselectedRequestHandlerClassName])) {
            /** @var RequestHandlerInterface $requestHandler */
            $requestHandler = $this->requestHandlers[$this->preselectedRequestHandlerClassName];
            if ($requestHandler->canHandleRequest()) {
                return $requestHandler;
            }
        }

        /** @var RequestHandlerInterface $requestHandler */
        foreach ($this->requestHandlers as $requestHandler) {
            if ($requestHandler->canHandleRequest() > 0) {
                $priority = $requestHandler->getPriority();
                if (isset($suitableRequestHandlers[$priority])) {
                    throw new FlowException('More than one request handler with the same priority can handle the request, but only one handler may be active at a time!', 1176475350);
                }
                $suitableRequestHandlers[$priority] = $requestHandler;
            }
        }
        if (empty($suitableRequestHandlers)) {
            throw new FlowException('No suitable request handler could be found for the current request. This is most likely a setup-problem, so please check your composer.json and/or try removing Configuration/PackageStates.php', 1464882543);
        }
        ksort($suitableRequestHandlers);
        return array_pop($suitableRequestHandlers);
    }
protected function resolveRequestHandler ( ) : RequestHandlerInterface { if ( $ this -> preselectedRequestHandlerClassName !== null && isset ( $ this -> requestHandlers [ $ this -> preselectedRequestHandlerClassName ] ) ) { /** @var RequestHandlerInterface $requestHandler */ $ requestHandler = $ this -> requestHandlers [ $ this -> preselectedRequestHandlerClassName ] ; if ( $ requestHandler -> canHandleRequest ( ) ) { return $ requestHandler ; } } /** @var RequestHandlerInterface $requestHandler */ foreach ( $ this -> requestHandlers as $ requestHandler ) { if ( $ requestHandler -> canHandleRequest ( ) > 0 ) { $ priority = $ requestHandler -> getPriority ( ) ; if ( isset ( $ suitableRequestHandlers [ $ priority ] ) ) { throw new FlowException ( 'More than one request handler with the same priority can handle the request, but only one handler may be active at a time!' , 1176475350 ) ; } $ suitableRequestHandlers [ $ priority ] = $ requestHandler ; } } if ( empty ( $ suitableRequestHandlers ) ) { throw new FlowException ( 'No suitable request handler could be found for the current request. This is most likely a setup-problem, so please check your composer.json and/or try removing Configuration/PackageStates.php' , 1464882543 ) ; } ksort ( $ suitableRequestHandlers ) ; return array_pop ( $ suitableRequestHandlers ) ; }
Iterates over the registered request handlers and determines which one fits best.

@return RequestHandlerInterface A request handler
@throws FlowException
Iterates over the registered request handlers and determines which one fits best .