function RouteCompiler::findNextSeparator
Returns the next static character in the Route pattern that will serve as a separator (or the empty string when none available).
1 call to RouteCompiler::findNextSeparator()
- RouteCompiler::compilePattern in vendor/
symfony/ routing/ RouteCompiler.php
File
-
vendor/
symfony/ routing/ RouteCompiler.php, line 265
Class
- RouteCompiler
- RouteCompiler compiles Route instances to CompiledRoute instances.
Namespace
Symfony\Component\RoutingCode
private static function findNextSeparator(string $pattern, bool $useUtf8) : string {
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\\x80-\\xFF]+\\}#', '', $pattern))) {
return '';
}
if ($useUtf8) {
preg_match('/^./u', $pattern, $pattern);
}
return str_contains(static::SEPARATORS, $pattern[0]) ? $pattern[0] : '';
}