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() deprecated

Returns the options.

array
getDefaults() deprecated

Returns the defaults.

array
getRequirements() deprecated

Returns the requirements.

array
__serialize()

{@inheritdoc}

void
__unserialize(array $data)

{@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() deprecated

deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. No direct replacement is provided.

Returns the options.

Return Value

array

The options.

See also

https://www.drupal.org/node/3159706

array getDefaults() deprecated

deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. No direct replacement is provided.

Returns the defaults.

Return Value

array

The defaults.

See also

https://www.drupal.org/node/3159706

array getRequirements() deprecated

deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. No direct replacement is provided.

Returns the requirements.

Return Value

array

The requirements.

See also

https://www.drupal.org/node/3159706

array __serialize()

{@inheritdoc}

Return Value

array

void __unserialize(array $data)

{@inheritdoc}

Parameters

array $data

Return Value

void