function RouteMatch::__construct

Same name in other branches
  1. 9 core/lib/Drupal/Core/Routing/RouteMatch.php \Drupal\Core\Routing\RouteMatch::__construct()
  2. 8.9.x core/lib/Drupal/Core/Routing/RouteMatch.php \Drupal\Core\Routing\RouteMatch::__construct()
  3. 10 core/lib/Drupal/Core/Routing/RouteMatch.php \Drupal\Core\Routing\RouteMatch::__construct()

Constructs a RouteMatch object.

Parameters

string $route_name: The name of the route.

\Symfony\Component\Routing\Route $route: The route.

array $parameters: The parameters array.

array $raw_parameters: The raw $parameters array.

File

core/lib/Drupal/Core/Routing/RouteMatch.php, line 55

Class

RouteMatch
Default object representing the results of routing.

Namespace

Drupal\Core\Routing

Code

public function __construct($route_name, Route $route, array $parameters = [], array $raw_parameters = []) {
    $this->routeName = $route_name;
    $this->route = $route;
    // Pre-filter parameters.
    $route_params = $this->getParameterNames();
    $parameters = array_intersect_key($parameters, $route_params);
    $raw_parameters = array_intersect_key($raw_parameters, $route_params);
    $this->parameters = new ParameterBag($parameters);
    $this->rawParameters = new InputBag($raw_parameters);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.