Symfony\Component\Routing\RouteCompiler::findNextSeparator PHP Method

findNextSeparator() private static method

Returns the next static character in the Route pattern that will serve as a separator.
private static findNextSeparator ( string $pattern, boolean $useUtf8 ) : string
$pattern string The route pattern
$useUtf8 boolean Whether the character is encoded in UTF-8 or not
return string The next static character that functions as separator (or empty string when none available)
    private static function findNextSeparator($pattern, $useUtf8)
    {
        if ('' == $pattern) {
            // return empty string if pattern is empty or false (false which can be returned by substr)
            return '';
        }
        // first remove all placeholders from the pattern so we can find the next real static character
        if ('' === ($pattern = preg_replace('#\\{\\w+\\}#', '', $pattern))) {
            return '';
        }
        if ($useUtf8) {
            preg_match('/^./u', $pattern, $pattern);
        }
        return false !== strpos(static::SEPARATORS, $pattern[0]) ? $pattern[0] : '';
    }