src/Filter/FilterUrlBuilder.php
private function getFolderUrlFragments(string $alias, string $host, string $locale = null): ?array
    {
        // Check if there are pages with a matching alias
        $pages = $this->getPageCandidates($alias);
        if (null === $pages) {
            return null;
        }

        // Look for a root page whose domain name matches the host name
        if (isset($pages[$host])) {
            $languages = $pages[$host];
        } else {
            // empty domain
            $languages = $pages['*'] ?: [];
        }
        unset($pages);

        $pages = [];

        if (!$this->isLocalePrepended) {
            // Use the first result (see #4872)
            $pages = current($languages);
        } elseif ($locale && isset($languages[$locale])) {
            // Try to find a page matching the language parameter
            $pages = $languages[$locale];
        }

        // Return if there are no matches
        if (empty($pages)) {
            return null;
        }

        /** @var PageModel $page */
        $page = $pages[0];

        // The request consists of the alias only
        if ($alias == $page->alias) {
            $arrFragments = [$alias];
        } else {
            // Remove the alias from the request string, explode it and then re-insert it at the beginning.
            $arrFragments = explode('/', substr($alias, (\strlen($page->alias) + 1)));
            array_unshift($arrFragments, $page->alias);
        }

        return $arrFragments;
    }
private function getFolderUrlFragments(string $alias, string $host, string $locale = null): ?array
    {
        // Check if there are pages with a matching alias
        $pages = $this->getPageCandidates($alias);
        if (null === $pages) {
            return null;
        }

        // Look for a root page whose domain name matches the host name
        if (isset($pages[$host])) {
            $languages = $pages[$host];
        } else {
            // empty domain
            $languages = $pages['*'] ?: [];
        }
        unset($pages);

        $pages = [];

        if (!$this->isLocalePrepended) {
            // Use the first result (see #4872)
            $pages = current($languages);
        } elseif ($locale && isset($languages[$locale])) {
            // Try to find a page matching the language parameter
            $pages = $languages[$locale];
        }

        // Return if there are no matches
        if (empty($pages)) {
            return null;
        }

        /** @var PageModel $page */
        $page = $pages[0];

        // The request consists of the alias only
        if ($alias == $page->alias) {
            $arrFragments = [$alias];
        } else {
            // Remove the alias from the request string, explode it and then re-insert it at the beginning.
            $arrFragments = explode('/', substr($alias, (\strlen($page->alias) + 1)));
            array_unshift($arrFragments, $page->alias);
        }

        return $arrFragments;
    }
private function getFolderUrlFragments ( string $ alias , string $ host , string $ locale = null ) : ? array { // Check if there are pages with a matching alias $ pages = $ this -> getPageCandidates ( $ alias ) ; if ( null === $ pages ) { return null ; } // Look for a root page whose domain name matches the host name if ( isset ( $ pages [ $ host ] ) ) { $ languages = $ pages [ $ host ] ; } else { // empty domain $ languages = $ pages [ '*' ] ? : [ ] ; } unset ( $ pages ) ; $ pages = [ ] ; if ( ! $ this -> isLocalePrepended ) { // Use the first result (see #4872) $ pages = current ( $ languages ) ; } elseif ( $ locale && isset ( $ languages [ $ locale ] ) ) { // Try to find a page matching the language parameter $ pages = $ languages [ $ locale ] ; } // Return if there are no matches if ( empty ( $ pages ) ) { return null ; } /** @var PageModel $page */ $ page = $ pages [ 0 ] ; // The request consists of the alias only if ( $ alias == $ page -> alias ) { $ arrFragments = [ $ alias ] ; } else { // Remove the alias from the request string, explode it and then re-insert it at the beginning. $ arrFragments = explode ( '/' , substr ( $ alias , ( \ strlen ( $ page -> alias ) + 1 ) ) ) ; array_unshift ( $ arrFragments , $ page -> alias ) ; } return $ arrFragments ; }
Update the fragments for folder URL aliases.

@param string      $alias  The relative request.
@param string      $host   The host part of the current request.
@param string|null $locale The current locale or null if none requested.

@return array
Update the fragments for folder URL aliases .