RouteCompiler
in package
implements
RouteCompilerInterface
RouteCompiler compiles Route instances to CompiledRoute instances.
Tags
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
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
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