public static function RouteCompiler::compile in Zircon Profile 8
Same name in this branch
- 8 vendor/symfony/routing/RouteCompiler.php \Symfony\Component\Routing\RouteCompiler::compile()
- 8 core/lib/Drupal/Core/Routing/RouteCompiler.php \Drupal\Core\Routing\RouteCompiler::compile()
Same name and namespace in other branches
- 8.0 vendor/symfony/routing/RouteCompiler.php \Symfony\Component\Routing\RouteCompiler::compile()
Throws
\LogicException If a variable is referenced more than once
\DomainException If a variable name is numeric because PHP raises an error for such subpatterns in PCRE and thus would break matching, e.g. "(?P<123>.+)".
Overrides RouteCompilerInterface::compile
1 call to RouteCompiler::compile()
- RouteCompiler::compile in core/
lib/ Drupal/ Core/ Routing/ RouteCompiler.php - Compiles the current route instance.
1 method overrides RouteCompiler::compile()
- RouteCompiler::compile in core/
lib/ Drupal/ Core/ Routing/ RouteCompiler.php - Compiles the current route instance.
File
- vendor/
symfony/ routing/ RouteCompiler.php, line 38
Class
- RouteCompiler
- RouteCompiler compiles Route instances to CompiledRoute instances.
Namespace
Symfony\Component\RoutingCode
public static function compile(Route $route) {
$hostVariables = array();
$variables = array();
$hostRegex = null;
$hostTokens = array();
if ('' !== ($host = $route
->getHost())) {
$result = self::compilePattern($route, $host, true);
$hostVariables = $result['variables'];
$variables = $hostVariables;
$hostTokens = $result['tokens'];
$hostRegex = $result['regex'];
}
$path = $route
->getPath();
$result = self::compilePattern($route, $path, false);
$staticPrefix = $result['staticPrefix'];
$pathVariables = $result['variables'];
$variables = array_merge($variables, $pathVariables);
$tokens = $result['tokens'];
$regex = $result['regex'];
return new CompiledRoute($staticPrefix, $regex, $tokens, $pathVariables, $hostRegex, $hostTokens, $hostVariables, array_unique($variables));
}