Documentation

RouteCompiler
in package
implements RouteCompilerInterface

RouteCompiler compiles Route instances to CompiledRoute instances.

Tags
author

Fabien Potencier fabien@symfony.com

author

Tobias Schultze http://tobion.de

Interfaces, Classes and Traits

RouteCompilerInterface
RouteCompilerInterface is the interface that all RouteCompiler classes must implement.

Table of Contents

REGEX_DELIMITER  = '#'
SEPARATORS  = '/,;.:-_~+*=@|'
This string defines the characters that are automatically considered separators in front of optional placeholders (with default and no static text following). Such a single separator can be left out together with the optional placeholder from matching and generating URLs.
compile()  : CompiledRoute
Compiles the current route instance.
compilePattern()  : array<string|int, mixed>
computeRegexp()  : string
Computes the regexp used to match a specific token. It can be static text or a subpattern.
determineStaticPrefix()  : string
Determines the longest static prefix possible for a route.
findNextSeparator()  : string
Returns the next static character in the Route pattern that will serve as a separator (or the empty string when none available).
transformCapturingGroupsToNonCapturings()  : string

Constants

REGEX_DELIMITER

public mixed REGEX_DELIMITER = '#'
Tags
deprecated

since Symfony 5.1, to be removed in 6.0

SEPARATORS

This string defines the characters that are automatically considered separators in front of optional placeholders (with default and no static text following). Such a single separator can be left out together with the optional placeholder from matching and generating URLs.

public mixed SEPARATORS = '/,;.:-_~+*=@|'

Methods

compile()

Compiles the current route instance.

public static compile(Route $route) : CompiledRoute
Parameters
$route : Route
Tags
throws
InvalidArgumentException

if a path variable is named _fragment

throws
LogicException

if a variable is referenced more than once

throws
DomainException

if a variable name starts with a digit or if it is too long to be successfully used as a PCRE subpattern

Return values
CompiledRoute

compilePattern()

private static compilePattern(Route $route, string $pattern, bool $isHost) : array<string|int, mixed>
Parameters
$route : Route
$pattern : string
$isHost : bool
Return values
array<string|int, mixed>

computeRegexp()

Computes the regexp used to match a specific token. It can be static text or a subpattern.

private static computeRegexp(array<string|int, mixed> $tokens, int $index, int $firstOptional) : string
Parameters
$tokens : array<string|int, mixed>

The route tokens

$index : int

The index of the current token

$firstOptional : int

The index of the first optional token

Return values
string

determineStaticPrefix()

Determines the longest static prefix possible for a route.

private static determineStaticPrefix(Route $route, array<string|int, mixed> $tokens) : string
Parameters
$route : Route
$tokens : array<string|int, mixed>
Return values
string

findNextSeparator()

Returns the next static character in the Route pattern that will serve as a separator (or the empty string when none available).

private static findNextSeparator(string $pattern, bool $useUtf8) : string
Parameters
$pattern : string
$useUtf8 : bool
Return values
string

transformCapturingGroupsToNonCapturings()

private static transformCapturingGroupsToNonCapturings(string $regexp) : string
Parameters
$regexp : string
Return values
string

Search results