private function matchCustomUrl($url, PortalInformation $portalInformation, Request $request)
    {
        $webspace = $portalInformation->getWebspace();
        $routeDocument = $this->customUrlManager->findRouteByUrl(
            rawurldecode($url),
            $webspace->getKey()
        );

        if (!$routeDocument) {
            return [];
        } elseif ($routeDocument->isHistory()) {
            // redirect happen => no portal is needed
            return ['customUrlRoute' => $routeDocument];
        }

        $customUrlDocument = $this->customUrlManager->findByUrl(
            rawurldecode($url),
            $webspace->getKey(),
            $routeDocument->getTargetDocument()->getTargetLocale()
        );

        if (null === $customUrlDocument
            || false === $customUrlDocument->isPublished()
            || null === $customUrlDocument->getTargetDocument()
            || WorkflowStage::PUBLISHED !== $customUrlDocument->getTargetDocument()->getWorkflowStage()
        ) {
            // error happen because this custom-url is not published => no portal is needed
            return ['customUrlRoute' => $routeDocument, 'customUrl' => $customUrlDocument];
        }

        $localization = Localization::createFromString($customUrlDocument->getTargetLocale());

        $portalInformations = $this->webspaceManager->findPortalInformationsByWebspaceKeyAndLocale(
            $portalInformation->getWebspace()->getKey(),
            $localization->getLocale(),
            $this->environment
        );

        if (0 === count($portalInformations)) {
            return ['customUrlRoute' => $routeDocument, 'customUrl' => $customUrlDocument];
        }

        return [
            'portalInformation' => $portalInformation,
            'localization' => $localization,
            'locale' => $localization->getLocale(),
            'customUrlRoute' => $routeDocument,
            'customUrl' => $customUrlDocument,
            'urlExpression' => $this->generator->generate(
                $customUrlDocument->getBaseDomain(),
                $customUrlDocument->getDomainParts()
            ),
        ];
    }