src/Filter/FilterUrlBuilder.php
private function strippedUri(Request $request): ?string
    {
        // Strip leading slash.
        if (null === $request || '' === $requestUri = rawurldecode(substr($request->getPathInfo(), 1))) {
            return null;
        }
        if ($this->isLocalePrepended) {
            $matches = [];
            // Use the matches instead of substr() (thanks to Mario Müller)
            if (preg_match('@^([a-z]{2}(-[A-Z]{2})?)/(.*)$@', $requestUri, $matches)) {
                $requestUri = $matches[3];
            }
        }

        // Remove the URL suffix if not just a language root (e.g. en/) is requested
        if ('' !== $this->urlSuffix && '' !== $requestUri && (
                !$this->isLocalePrepended || !preg_match('@^[a-z]{2}(-[A-Z]{2})?/$@', $requestUri)
            )) {
            $requestUri = substr($requestUri, 0, -\strlen($this->urlSuffix));
        }

        return $requestUri;
    }
private function strippedUri(Request $request): ?string
    {
        // Strip leading slash.
        if (null === $request || '' === $requestUri = rawurldecode(substr($request->getPathInfo(), 1))) {
            return null;
        }
        if ($this->isLocalePrepended) {
            $matches = [];
            // Use the matches instead of substr() (thanks to Mario Müller)
            if (preg_match('@^([a-z]{2}(-[A-Z]{2})?)/(.*)$@', $requestUri, $matches)) {
                $requestUri = $matches[3];
            }
        }

        // Remove the URL suffix if not just a language root (e.g. en/) is requested
        if ('' !== $this->urlSuffix && '' !== $requestUri && (
                !$this->isLocalePrepended || !preg_match('@^[a-z]{2}(-[A-Z]{2})?/$@', $requestUri)
            )) {
            $requestUri = substr($requestUri, 0, -\strlen($this->urlSuffix));
        }

        return $requestUri;
    }
private function strippedUri ( Request $ request ) : ? string { // Strip leading slash. if ( null === $ request || '' === $ requestUri = rawurldecode ( substr ( $ request -> getPathInfo ( ) , 1 ) ) ) { return null ; } if ( $ this -> isLocalePrepended ) { $ matches = [ ] ; // Use the matches instead of substr() (thanks to Mario Müller) if ( preg_match ( '@^([a-z]{2}(-[A-Z]{2})?)/(.*)$@' , $ requestUri , $ matches ) ) { $ requestUri = $ matches [ 3 ] ; } } // Remove the URL suffix if not just a language root (e.g. en/) is requested if ( '' !== $ this -> urlSuffix && '' !== $ requestUri && ( ! $ this -> isLocalePrepended || ! preg_match ( '@^[a-z]{2}(-[A-Z]{2})?/$@' , $ requestUri ) ) ) { $ requestUri = substr ( $ requestUri , 0 , - \ strlen ( $ this -> urlSuffix ) ) ; } return $ requestUri ; }
Strip the leading locale (if any).

@param Request $request The request.

@return string
Strip the leading locale ( if any ) .