You are here

public function CompiledRoute::__construct in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Routing/CompiledRoute.php \Drupal\Core\Routing\CompiledRoute::__construct()

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)

File

core/lib/Drupal/Core/Routing/CompiledRoute.php, line 64

Class

CompiledRoute
A compiled route contains derived information from a route object.

Namespace

Drupal\Core\Routing

Code

public function __construct($fit, $pattern_outline, $num_parts, $staticPrefix, $regex, array $tokens, array $pathVariables, $hostRegex = NULL, array $hostTokens = [], array $hostVariables = [], array $variables = []) {
  parent::__construct($staticPrefix, $regex, $tokens, $pathVariables, $hostRegex, $hostTokens, $hostVariables, $variables);
  $this->fit = $fit;

  // Support case-insensitive route matching by ensuring the pattern outline
  // is lowercase.
  // @see \Drupal\Core\Routing\RouteProvider::getRoutesByPath()
  $this->patternOutline = mb_strtolower($pattern_outline);
  $this->numParts = $num_parts;
}