@param string|null $parentId
@param string|null $suffix
@param string      $language
@param string      $siteId
@param array       $routePattern

@return string|null
331996
protected function completeRoutePattern($parentId = null, $suffix = null, $language, $siteId, array $routePattern)
    {
        if (is_null($parentId) || NodeInterface::ROOT_PARENT_ID == $parentId || '' == $parentId || 0 === strpos($suffix, '/')) {
            return $suffix;
        }

        if (isset($routePattern[$parentId])) {
            $parent = $routePattern[$parentId];

            return $this->suppressDoubleSlashes($this->completeRoutePattern($parent['parentId'], $parent['routePattern'] . '/' . $suffix, $language, $siteId, $routePattern));
        }

        return $suffix;
    }
206236
public function pageTitlePattern(
        $pattern,
        $language = null,
        TreeNodeInterface $treeNode = null,
        Siteroot $siteroot = null
    ) {
        $request = $this->requestStack->getCurrentRequest();

        if ($siteroot === null) {
            $siteroot = $request->attributes->get('siterootUrl')->getSiteroot();
        }

        if ($treeNode === null) {
            $treeNode = $request->get('contentDocument');
        }

        if ($language === null) {
            $language = $request->getLocale();
        }

        $title = $this->patternResolver->replacePattern(
            $pattern,
            $siteroot,
            $treeNode->getTree()->getContent($treeNode),
            $language
        );

        return $title;
    }
1149973
private function hasRoute($routePattern, $routeName)
    {
        if (!$routeName) {
            throw new RoutingRuntimeException('Route name is empty!');
        }

        $route = $this->routeManager->findByRoutePattern($routePattern);

        return ((null !== $route) && ($routeName !== $route->getName()));
    }
1038744
public function pageTitle($name = 'default', $language = null, $treeNode = null, Siteroot $siteroot = null)
    {
        $request = $this->requestStack->getCurrentRequest();

        if ($siteroot === null) {
            $siteroot = $request->attributes->get('siterootUrl')->getSiteroot();
        }

        if ($treeNode instanceof ContentTreeContext) {
            $treeNode = $treeNode->getNode();
        }

        if (!($treeNode instanceof TreeNodeInterface)) {
            $treeNode = $request->get('contentDocument');
        }

        if ($language === null) {
            $language = $request->getLocale();
        }

        $title = $this->patternResolver->replace(
            $name,
            $siteroot,
            $treeNode->getTree()->getContent($treeNode),
            $language
        );

        return $title;
    }
830514
public function getSectionRouteRules(string $section, string $format = 'Craft', $siteId = null): array
    {
        return RouteMap::$plugin->routes->getSectionRouteRules($section, $format, $siteId);
    }
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);
    }
985914
public function aliasPattern($pattern, $translation = null)
	{
		if ( ! is_array($pattern))
		{
			$pattern = [$pattern => $translation];
		}

		foreach ($pattern as $patternKey => $resolver)
		{
			if ( ! $resolver instanceof Resolver)
			{
				$resolver = new Resolver($patternKey, $resolver);
			}

			$this->patterns[$patternKey] = $resolver;
		}
	}
936418
public static function generateRouteName(string $adminName, string $actionName, string $routingPattern)
    {
        // generate the route name using the configured pattern
        $routeName = str_replace(
            '{admin}',
            strtolower($adminName),
            $routingPattern
        );
        $routeName = str_replace(
            '{action}',
            $actionName,
            $routeName
        );

        return $routeName;
    }
73451
public function updatePathIdentificationString($locationId, $parentLocationId, $text)
    {
        $parentData = $this->getBasicNodeData($parentLocationId);

        $newPathIdentificationString = empty($parentData['path_identification_string']) ?
            $text :
            $parentData['path_identification_string'] . '/' . $text;

        /** @var $query \eZ\Publish\Core\Persistence\Database\UpdateQuery */
        $query = $this->handler->createUpdateQuery();
        $query->update(
            'ezcontentobject_tree'
        )->set(
            $this->handler->quoteColumn('path_identification_string'),
            $query->bindValue($newPathIdentificationString, null, \PDO::PARAM_STR)
        )->where(
            $query->expr->eq(
                $this->handler->quoteColumn('node_id'),
                $query->bindValue($locationId, null, \PDO::PARAM_INT)
            )
        );
        $query->prepare()->execute();
    }
1106418
public function archiveUrlAliasesForDeletedTranslations($locationId, $parentId, array $languageIds)
    {
        // determine proper parent for linking historized entry
        $existingLocationEntry = $this->loadAutogeneratedEntry(
            'eznode:' . $locationId,
            $parentId
        );

        // filter existing URL alias entries by any of the specified removed languages
        $rows = $this->loadLocationEntriesMatchingMultipleLanguages(
            $locationId,
            $languageIds
        );

        // remove specific languages from a bit mask
        foreach ($rows as $row) {
            // filter mask to reduce the number of calls to storage engine
            $rowLanguageMask = (int) $row['lang_mask'];
            $languageIdsToBeRemoved = array_filter(
                $languageIds,
                function ($languageId) use ($rowLanguageMask) {
                    return $languageId & $rowLanguageMask;
                }
            );

            if (empty($languageIdsToBeRemoved)) {
                continue;
            }

            // use existing entry to link archived alias or use current alias id
            $linkToId = !empty($existingLocationEntry) ? $existingLocationEntry['id'] : $row['id'];
            foreach ($languageIdsToBeRemoved as $languageId) {
                $this->archiveUrlAliasForDeletedTranslation(
                    $row['lang_mask'],
                    $languageId,
                    $row['parent'],
                    $row['text_md5'],
                    $linkToId
                );
            }
        }
    }
354922
public function getWidgetUrl($languageId = null, $inAdmin = null, $urlParameters = [])
    {
        $utilsUrl = Registry::getUtilsUrl();
        $widgetUrl = $this->isSsl() ? $this->getSslShopUrl($languageId) : $this->getShopUrl($languageId, $inAdmin);
        $widgetUrl = $utilsUrl->processUrl($widgetUrl . 'widget.php', false);

        if (!isset($languageId)) {
            $language = Registry::getLang();
            $languageId = $language->getBaseLanguage();
        }
        $urlLang = $utilsUrl->getUrlLanguageParameter($languageId);
        $widgetUrl = $utilsUrl->appendUrl($widgetUrl, $urlLang, true);

        $widgetUrl = $utilsUrl->appendUrl($widgetUrl, $urlParameters, true, true);

        return $widgetUrl;
    }
193358
public function setCurrentSite($siteId, $siteName, $siteDefaultLanguage, array $languages)
    {
        parent::setSite($siteId, $siteName, $siteDefaultLanguage, $languages);
    }
124614
private function getUrlPattern(Router $router, $routeNameFromMappingFile, $baseUrl)
    {
        if (!empty($routeNameFromMappingFile)) {
            try {
                $route = $router->getRouteCollection()->get($routeNameFromMappingFile);
                if (empty($route)) {
                    throw new Exception();
                }
            } catch (Exception $e) {
                throw new RuntimeException(
                   \sprintf('Route \'%s\' has not been defined as a Symfony route.', $routeNameFromMappingFile)
               );
            }

            \preg_match_all('/{(.*?)}/', $route->getPath(), $matches);

            $pattern = [];
            if (!empty($matches)) {
                $pattern = \array_combine($matches[1], $matches[0]);
            }

            return $baseUrl.\urldecode($router->generate($routeNameFromMappingFile, $pattern, true));
        }

        return (string) $routeNameFromMappingFile;
    }
1098127
protected function generateRoutesForNode(NodeInterface $node, ReadSiteInterface $site, array $routePattern)
    {
        $routes = array();

        if (!$node instanceof NodeInterface) {
            return $routes;
        }

        $routeDocumentClass = $this->routeDocumentClass;

        /** @var SiteAliasInterface $alias */
        foreach ($site->getAliases() as $key => $alias) {
            if ($alias->getLanguage() == $node->getLanguage()) {
                /** @var RouteDocumentInterface $route */
                $route = new $routeDocumentClass();
                $route->setName($key . '_' . $node->getId());
                $route->setHost($alias->getDomain());
                $scheme = $node->getScheme();
                if (is_null($scheme) || SchemeableInterface::SCHEME_DEFAULT == $scheme) {
                    $scheme = $alias->getScheme();
                }
                $route->setSchemes($scheme);
                $route->setLanguage($node->getLanguage());
                $route->setNodeId($node->getNodeId());
                $route->setSiteId($site->getSiteId());
                $route->setAliasId($key);
                $pattern = $this->completeRoutePattern($node->getParentId(), $node->getRoutePattern(), $node->getLanguage(), $site->getSiteId(), $routePattern);
                if ($alias->getPrefix()) {
                    $pattern = $this->suppressDoubleSlashes('/' . $alias->getPrefix() . '/' . $pattern);
                }
                $route->setPattern($pattern);
                $routes[] = $route;
            }
        }

        return $routes;
    }
447766
protected function _addPageNrParam($url, $page, $languageId = null)
    {
        if ($page) {
            if ((strpos($url, 'pgNr='))) {
                $url = preg_replace('/pgNr=[0-9]*/', 'pgNr=' . $page, $url);
            } else {
                $url .= ((strpos($url, '?') === false) ? '?' : '&amp;') . 'pgNr=' . $page;
            }
        } else {
            $url = preg_replace('/pgNr=[0-9]*/', '', $url);
            $url = preg_replace('/\&amp\;\&amp\;/', '&amp;', $url);
            $url = preg_replace('/\?\&amp\;/', '?', $url);
            $url = preg_replace('/\&amp\;$/', '', $url);
        }

        return $url;
    }
699364
public static function nodesTreeList($parentId = 0, $level = 0, $shiftPrefix = '. ')
    {
        if (!isset(static::$_nodesTreeList[$parentId][$level][$shiftPrefix])) {
            $tree = [];
            $list = [];

            $parentNode = static::node($parentId);
            if (!empty($parentNode)) {
                $grandParentId = $parentNode['parent_id'];
                $grandParentNode = static::node($grandParentId);
                $nodePath = (empty($grandParentNode->nodePath)
                             ? '' : $grandParentNode->nodePath . '/'
                         ) . $parentNode['slug'];
                $list[$parentId] = str_repeat($shiftPrefix, $level) . $nodePath;
                $tree[$parentId] = str_repeat($shiftPrefix, $level) . $parentNode['slug'];
                static::saveNodePath($parentId, $nodePath);
            }

            $children = static::nodeChildren($parentId);
            foreach ($children as $child) {
                static::$_nodes[$child['id']] = $child;
                $list += static::nodesTreeList($child->id, $level+1, $shiftPrefix);
                $tree += static::nodesTree($child->id, $level+1, $shiftPrefix);
            }
            static::$_nodesTree[$parentId][$level][$shiftPrefix] = $tree;
            static::$_nodesTreeList[$parentId][$level][$shiftPrefix] = $list;
        }    
        return static::$_nodesTreeList[$parentId][$level][$shiftPrefix];
    }
130907
public static function getUrlsByParentId($isSuper, $menuIdList, $parentId, $condition = '', $params = [], $order = 'display_order asc')
    {
        $data = static::find()
            ->normal()
            ->findByParentId($parentId)
            ->andWhere($condition, $params)
            ->active()
            ->orderBy($order)
            ->asArray()
            ->all();
        $urls = [];
        if ($data) {
            foreach ($data as $item) {
                if ($isSuper || in_array($item['menu_id'], $menuIdList)) {
                    $menuUrls = DpAdminMenuUrlRelation::getAllUrlByMenuId($item['menu_id']);
                    if ($menuUrls) {
                        foreach ($menuUrls as $menuUrl) {
                            $urls[$menuUrl['alias']] = Url::toRoute($menuUrl['route']);
                        }
                    }
                    $childrenUrls = static::getUrlsByParentId($isSuper, $menuIdList, $item['menu_id'], $condition, $params, $order);
                    if ($childrenUrls) {
                        $urls = array_merge($urls, $childrenUrls);
                    }
                }
            }
        }

        return $urls;
    }