class CompiledRoute extends CompiledRoute (View source)

A compiled route contains derived information from a route object.

Properties

protected int $fit

The fitness of this route.

protected string $patternOutline

The pattern outline of this route.

protected int $numParts

The number of parts in the path of this route.

Methods

__construct(int $fit, string $pattern_outline, int $num_parts, string $staticPrefix, string $regex, array $tokens, array $pathVariables, string|null $hostRegex = NULL, array $hostTokens = [], array $hostVariables = [], array $variables = [])

Constructs a new compiled route object.

int
getFit()

Returns the fit of this route.

int
getNumParts()

Returns the number of parts in this route's path.

string
getPatternOutline()

Returns the pattern outline of this route.

array
getOptions()

Returns the options.

array
getDefaults()

Returns the defaults.

array
getRequirements()

Returns the requirements.

serialize()

{@inheritdoc}

unserialize($serialized)

{@inheritdoc}

Details

__construct(int $fit, string $pattern_outline, int $num_parts, string $staticPrefix, string $regex, array $tokens, array $pathVariables, string|null $hostRegex = NULL, array $hostTokens = [], array $hostVariables = [], array $variables = [])

Constructs a new compiled route object.

This is a ridiculously long set of constructor parameters, but as this object is little more than a collection of values it's not a serious problem. The parent Symfony class does the same, as well, making it difficult to override differently.

Parameters

int $fit

The fitness of the route.

string $pattern_outline

The pattern outline for this route.

int $num_parts

The number of parts in the path.

string $staticPrefix

The static prefix of the compiled route

string $regex

The regular expression to use to match this route

array $tokens

An array of tokens to use to generate URL for this route

array $pathVariables

An array of path variables

string|null $hostRegex

Host regex

array $hostTokens

Host tokens

array $hostVariables

An array of host variables

array $variables

An array of variables (variables defined in the path and in the host patterns)

int getFit()

Returns the fit of this route.

See RouteCompiler for a definition of how the fit is calculated.

Return Value

int

The fit of the route.

int getNumParts()

Returns the number of parts in this route's path.

The string "foo/bar/baz" has 3 parts, regardless of how many of them are placeholders.

Return Value

int

The number of parts in the path.

string getPatternOutline()

Returns the pattern outline of this route.

The pattern outline of a route is the path pattern of the route, but normalized such that all placeholders are replaced with %.

Return Value

string

The normalized path pattern.

array getOptions()

Returns the options.

Return Value

array

The options.

array getDefaults()

Returns the defaults.

Return Value

array

The defaults.

array getRequirements()

Returns the requirements.

Return Value

array

The requirements.

serialize()

{@inheritdoc}

unserialize($serialized)

{@inheritdoc}

Parameters

$serialized