src/Filter/FilterUrlBuilder.php
private function determineFragments(Request $request): ?array
    {
        if (null === $requestUri = $this->strippedUri($request)) {
            return null;
        }

        $fragments = null;
        // Use folder-style URLs
        if (Config::get('folderUrl') && false !== strpos($requestUri, '/')) {
            $fragments = $this->getFolderUrlFragments(
                $requestUri,
                $request->getHost(),
                $request->attributes->get('_locale')
            );
        }

        // If folderUrl is deactivated or did not find a matching page
        if (null === $fragments) {
            if ('/' === $requestUri) {
                return null;
            }
            $fragments = explode('/', $requestUri);
        }

        // Add the second fragment as auto_item if the number of fragments is even
        if (Config::get('useAutoItem') && 0 === (\count($fragments) % 2)) {
            array_insert($fragments, 1, ['auto_item']);
        }

        $fragments = $this->getPageIdFromUrlHook($fragments);

        // Return if the alias is empty (see #4702 and #4972)
        if (null === $fragments || ('' === $fragments[0] && \count($fragments) > 1)) {
            return null;
        }

        return $fragments;
    }
private function determineFragments(Request $request): ?array
    {
        if (null === $requestUri = $this->strippedUri($request)) {
            return null;
        }

        $fragments = null;
        // Use folder-style URLs
        if (Config::get('folderUrl') && false !== strpos($requestUri, '/')) {
            $fragments = $this->getFolderUrlFragments(
                $requestUri,
                $request->getHost(),
                $request->attributes->get('_locale')
            );
        }

        // If folderUrl is deactivated or did not find a matching page
        if (null === $fragments) {
            if ('/' === $requestUri) {
                return null;
            }
            $fragments = explode('/', $requestUri);
        }

        // Add the second fragment as auto_item if the number of fragments is even
        if (Config::get('useAutoItem') && 0 === (\count($fragments) % 2)) {
            array_insert($fragments, 1, ['auto_item']);
        }

        $fragments = $this->getPageIdFromUrlHook($fragments);

        // Return if the alias is empty (see #4702 and #4972)
        if (null === $fragments || ('' === $fragments[0] && \count($fragments) > 1)) {
            return null;
        }

        return $fragments;
    }
Determine the fragments for the passed request.

@param Request $request The request to parse.

@return array|null

@@SuppressWarnings(PHPMD.CyclomaticComplexity)
@@SuppressWarnings(PHPMD.NPathComplexity)