@param Route $searchRoute

@return null|string
@author Maximilian Ruta <mr@xtain.net>
185137
public function findMatchingPaths(Route $searchRoute)
    {
        if (isset($this->cachedRoutes[$searchRoute->getPath()])) {
            return $this->cachedRoutes[$searchRoute->getPath()];
        }

        /** @var Route $route */
        foreach ($this->getSortedRoutes() as $routePath => $name) {
            if (preg_match('#^' . preg_quote(rtrim($routePath, '/') . '/', '#') . '#', $searchRoute->getPath())) {
                $this->cachedRoutes[$searchRoute->getPath()] = $name;

                return $name;
            }
        }

        return null;
    }
926292
public function execute(SearchParams $searchParams) {
        $path = self::getPath($searchParams);
        $builder = new UrlParamsBuilder($searchParams);
        return $this->openSearchClient->get($path, $builder->getHttpParams());
    }
216583
private function getUriParams($route)
    {
        preg_match_all('~{(\w+)}~', $this->getRouteParam($route, 'uri'), $matches);
        
        return isset($matches[1]) ? $matches[1] : [];
    }
1276675
public function matches(Route $route, Request $request)
    {
        /** @var \LaraPress\Routing\Route $route */
        return $route->wordpressConditional() == null || call_user_func($route->wordpressConditional(), $route->uri());
    }
142591
public function getFullRoute($routePart = '')
    {
        if ($routePart == '') {
            $routePart = $this->route;
        }
        
        $delimiter = $this->getRouteDelimiter();
        if (substr($routePart, 0, strlen($delimiter)) !== $delimiter) {
            $routePart = $delimiter . $routePart;
        }
        
        $posPoint = strrpos($routePart, '.');
        if (substr($routePart, -1) !== $delimiter && ($posPoint === false || $posPoint < strrpos($routePart, $delimiter))) {
            $routePart .= $delimiter;
        }
        
        return $this->base . $routePart;
    }
1112921
protected function shouldHideResultsFromInitialSearch(SearchRequest $searchRequest)
    {
        return ($this->typoScriptConfiguration->getSearchInitializeWithEmptyQuery() ||
            $this->typoScriptConfiguration->getSearchInitializeWithQuery()) &&
            !$this->typoScriptConfiguration->getSearchShowResultsOfInitialEmptyQuery() &&
            !$this->typoScriptConfiguration->getSearchShowResultsOfInitialQuery() &&
            $searchRequest->getRawUserQueryIsNull();
    }
285786
private function getRoutesFromIndex (&$routes, &$routesIndex, &$requestMethod, &$requestPathParts, $requestPathIndex = 0) {
        if (!empty($requestPathParts[$requestPathIndex])) {
            $requestPathPart = $requestPathParts[$requestPathIndex];
            if (array_key_exists($requestPathPart, $routesIndex)) {
                $this->getRoutesFromIndex($routes,$routesIndex[$requestPathPart], $requestMethod, $requestPathParts, $requestPathIndex + 1);
            }
            if (array_key_exists(self::ROUTE_PARAMETER_WILDCARD, $routesIndex)) {
                $this->getRoutesFromIndex($routes,$routesIndex[self::ROUTE_PARAMETER_WILDCARD], $requestMethod, $requestPathParts, $requestPathIndex + 1);
            }
        }
        else if (array_key_exists(self::ROUTE_ACTIONS_KEY, $routesIndex)) {
            $testRoutes = &$routesIndex[self::ROUTE_ACTIONS_KEY];
            if (array_key_exists($requestMethod, $testRoutes)) {
                $this->getRoutesFromIndexActions($routes,$testRoutes[$requestMethod], $requestMethod,$requestPathParts);
            }
            if (array_key_exists(self::ROUTE_GENERIC_METHOD, $testRoutes)) {
                $this->getRoutesFromIndexActions($routes,$testRoutes[self::ROUTE_GENERIC_METHOD], $requestMethod, $requestPathParts);
            }
        }

        if (array_key_exists(self::ROUTE_GENERIC_ACTIONS_KEY, $routesIndex)) {
            $testRoutes = &$routesIndex[self::ROUTE_GENERIC_ACTIONS_KEY];
            if (array_key_exists($requestMethod, $testRoutes)) {
                $this->getRoutesFromIndexActions($routes,$testRoutes[$requestMethod], $requestMethod, $requestPathParts);
            }
            if (array_key_exists(self::ROUTE_GENERIC_METHOD, $testRoutes)) {
                $this->getRoutesFromIndexActions($routes,$testRoutes[self::ROUTE_GENERIC_METHOD], $requestMethod, $requestPathParts);
            }
        }
    }
893804
public function findOneByRoute($routeName)
    {
        $qb = $this->getQueryBuilder('p');

        return $qb
            ->leftJoin('p.seo', 's')
            ->leftJoin('s.translations', 's_t', Expr\Join::WITH, $this->getLocaleCondition('s_t'))
            ->addSelect('s', 's_t')
            ->andWhere($qb->expr()->eq('p.route', ':route_name'))
            ->getQuery()
            ->setParameter('route_name', $routeName)
            ->useQueryCache(true)
            // TODO ->useResultCache(true, 3600, 'ekyna_cms.page[route:' . $routeName . ']')
            ->getOneOrNullResult();
    }
226424
private function checkForMetaRoute($route)
    {
        $this->baseRoute = $route;
        $this->metaRoute = null;

        // If route exits in index, use it
        if ($this->mapRoute2IndexKey($route)) {
            return $route;
        }

        // Check for pagination
        $pagination = $this->config["pagination"];
        $matches = [];
        $pattern = "/(.*?)\/($pagination)\/(\d+)$/";
        if (preg_match($pattern, $route, $matches)) {
            $this->baseRoute = $matches[1];
            $this->metaRoute = $route;
            $this->currentPage = $matches[3];
        }

        return $this->baseRoute;
    }
859564
public function action($removeHttpMethod = true)
    {
        if ($action = $this->router->currentRouteAction()) {
            $action = last(Str::parseCallback($action, null));

            if ($removeHttpMethod) {
                $action = str_replace(['get', 'post', 'patch', 'put', 'delete'], '', $action);
            }

            return Str::snake($action, '-');
        }

        return null;
    }
520855
private function createRegexp($uri, Route $route)
    {
        $patterns = [];
        foreach ($route->getParameterPatterns() as $key => $pattern) {
            $patterns['\\{' . $key . '\\}'] = '(' . $pattern . ')';
        }
        $uri = preg_quote($uri, '#');

        return strtr($uri, $patterns);
    }
20791
public function getRouteFromName(string $routeName) : ?RouteInterface
    {
        foreach ($this->routes as $route) {
            if ($route->getName() == $routeName) {
                return $route;
            }
        }
        return null;
    }
902752
public function route(Request $request)
    {
        foreach ($this->routes as $route) {
            if ($route->matches($request)) {
                return $route;
            }
        }

        return null;
    }
775738
public function execute(SearchParams $searchParams) {
        $path = self::getPath($searchParams);
        $params = SuggestParamsBuilder::getQueryParams($searchParams);
        return $this->openSearchClient->get($path, $params);
    }
505253
public function findRoute() {
        if (isset($_SERVER['REQUEST_URI'])) {

            $matched_uris = array();
            $routes_group = array();
            $request_uri = preg_replace('/[?]/', '', $_SERVER['REQUEST_URI']);

            foreach ($this->routes as $route) {
                if (trim(urldecode($request_uri), '/') == $route['uri']) {
                    $matched_uris[] = $route['uri'];
                    $route['args'] = [];
                    array_push($routes_group, $route);
                }
            }

            if (!$matched_uris) {
                foreach ($this->routes as $route) {
                    $route['uri'] = str_replace('/', '\/', $route['uri']);
                    $route['uri'] = preg_replace_callback('/\[(:num)(:([0-9]+))*\](\?)?/', array($this, 'findPattern'), $route['uri']);
                    $route['uri'] = preg_replace_callback('/\[(:alpha)(:([0-9]+))*\](\?)?/', array($this, 'findPattern'), $route['uri']);
                    $route['uri'] = preg_replace_callback('/\[(:any)(:([0-9]+))*\](\?)?/', array($this, 'findPattern'), $route['uri']);

                    $request_uri = parse_url($_SERVER['REQUEST_URI']);

                    preg_match("/^\/" . $route['uri'] . "$/u", urldecode($request_uri['path']), $matches);

                    if ($matches) {
                        array_push($matched_uris, $matches[0]);
                        array_shift($matches);

                        $route['args'] = $matches;
                        array_push($routes_group, $route);
                    }
                }
            }

            if (!$matched_uris) {
                self::$currentRoute = NULL;
                HookManager::call('pageNotFound');
            }

            if ($matched_uris) {
                if (count($routes_group) > 1) {

                    self::$currentModule = $routes_group[0]['module'];

                    for ($i = 0; $i < count($routes_group) - 1; $i++) {
                        for ($j = $i + 1; $j < count($routes_group); $j++) {
                            if ($routes_group[$i]['method'] == $routes_group[$j]['method']) {
                                self::$currentRoute = NULL;
                                throw new RouteException(_message(ExceptionMessages::REPETITIVE_ROUTE_SAME_METHOD, $routes_group[$j]['method']));
                                break 2;
                            }
                            if ($routes_group[$i]['module'] != $routes_group[$j]['module']) {
                                self::$currentRoute = NULL;
                                throw new RouteException(ExceptionMessages::REPETITIVE_ROUTE_DIFFERENT_MODULES);
                                break 2;
                            }
                        }
                    }

                    foreach ($routes_group as $route) {
                        if (strpos($route['method'], '|') !== false) {
                            if (in_array($_SERVER['REQUEST_METHOD'], explode('|', $route['method']))) {
                                self::$currentRoute = $route;
                                break;
                            }
                        } else if ($_SERVER['REQUEST_METHOD'] == $route['method']) {
                            self::$currentRoute = $route;
                            break;
                        }
                    }
                } else {
                    self::$currentModule = $routes_group[0]['module'];
                    self::$currentRoute = $routes_group[0];
                }
            }

            HookManager::call('handleHeaders');

            if ($_SERVER['REQUEST_METHOD'] != 'OPTIONS') {
                $this->checkMethod();
            }
        }
    }
220192
public function getRoute(): RouteInterface
    {
        // Find route by regexp and URI
        $matches = $this->getMatches();

        // Cleanup the array of matches, then reindex array
        $matches = array_values(array_filter($matches));

        // If we have some classes in result of regexp
        $result = !empty($matches)
            // Take first from matches
            ? $matches[0] // Here the Route() object
            // Create new object with error inside
            : $this->getError();

        return $result;
    }
1236759
public function getMatchingRoute($routes, Request $request)
    {
        foreach ($routes as $matchingRoute) {
            if ($matchingRoute->matches($request)) {
                return $matchingRoute;
            }
        }

        return null;
    }