private static function generateRegex(array $matches, array $parameterPatterns): string
    {
        $regex = '/^';

        foreach ($matches as $match) {
            [$type, $part] = $match;

            if ($type === self::STATIC_PART) {
                $regex .= \preg_quote($part, '/');
            } else {
                // Parameter, $part is the parameter name
                $pattern = $parameterPatterns[$part] ?? Pattern::ANY;
                $regex .= '(' . $pattern . ')';
            }
        }

        return $regex . '$/';
    }
private static function generateRegex(array $matches, array $parameterPatterns): string
    {
        $regex = '/^';

        foreach ($matches as $match) {
            [$type, $part] = $match;

            if ($type === self::STATIC_PART) {
                $regex .= \preg_quote($part, '/');
            } else {
                // Parameter, $part is the parameter name
                $pattern = $parameterPatterns[$part] ?? Pattern::ANY;
                $regex .= '(' . $pattern . ')';
            }
        }

        return $regex . '$/';
    }
private static function generateRegex ( array $ matches , array $ parameterPatterns ) : string { $ regex = '/^' ; foreach ( $ matches as $ match ) { [ $ type , $ part ] = $ match ; if ( $ type === self :: STATIC_PART ) { $ regex .= \ preg_quote ( $ part , '/' ) ; } else { // Parameter, $part is the parameter name $ pattern = $ parameterPatterns [ $ part ] ?? Pattern :: ANY ; $ regex .= '(' . $ pattern . ')' ; } } return $ regex . '$/' ; }
Generate a segment regex.

@param array $matches
@param array $parameterPatterns

@return string
Generate a segment regex .