You are here

private static function RouteCompiler::findNextSeparator in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/routing/RouteCompiler.php \Symfony\Component\Routing\RouteCompiler::findNextSeparator()

Returns the next static character in the Route pattern that will serve as a separator.

Parameters

string $pattern The route pattern:

Return value

string The next static character that functions as separator (or 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 179

Class

RouteCompiler
RouteCompiler compiles Route instances to CompiledRoute instances.

Namespace

Symfony\Component\Routing

Code

private static function findNextSeparator($pattern) {
  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
  $pattern = preg_replace('#\\{\\w+\\}#', '', $pattern);
  return isset($pattern[0]) && false !== strpos(static::SEPARATORS, $pattern[0]) ? $pattern[0] : '';
}