diff --git a/core/lib/Drupal/Core/Routing/CurrentRouteMatch.php b/core/lib/Drupal/Core/Routing/CurrentRouteMatch.php index 206c2a1..c8c6239 100644 --- a/core/lib/Drupal/Core/Routing/CurrentRouteMatch.php +++ b/core/lib/Drupal/Core/Routing/CurrentRouteMatch.php @@ -11,6 +11,9 @@ use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\RequestStack; +/** + * Default object for current_route_match service. + */ class CurrentRouteMatch implements RouteMatchInterface { protected $requestStack; diff --git a/core/lib/Drupal/Core/Routing/RouteMatch.php b/core/lib/Drupal/Core/Routing/RouteMatch.php index 45ff9ec..85c854b 100644 --- a/core/lib/Drupal/Core/Routing/RouteMatch.php +++ b/core/lib/Drupal/Core/Routing/RouteMatch.php @@ -10,6 +10,10 @@ use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\Routing\Route; +/** + * Default object representing the results of routing. + * + */ class RouteMatch implements RouteMatchInterface { /** @@ -27,18 +31,18 @@ class RouteMatch implements RouteMatchInterface { protected $route; /** - * A key|value store of arguments. + * A key|value store of parameters. * * @var \Symfony\Component\HttpFoundation\ParameterBag */ - protected $arguments; + protected $parameters; /** - * A key|value store of raw arguments. + * A key|value store of raw parameters. * * @var \Symfony\Component\HttpFoundation\ParameterBag */ - protected $rawArguments; + protected $rawParameters; /** * Constructs a RouteMatch object. @@ -47,16 +51,17 @@ class RouteMatch implements RouteMatchInterface { * The name of the route. * @param \Symfony\Component\Routing\Route $route * The route. - * @param array $arguments - * The arguments array. - * @param array $raw_arguments - * The raw $arguments array. + * @param array $parameters + * The parameters array. + * @param array $raw_parameters + * The raw $parameters array. + * @internal param array $parameters The parameters array.* The parameters array. */ - public function __construct($route_name, Route $route, $arguments = array(), $raw_arguments = array()) { + public function __construct($route_name, Route $route, $parameters = array(), $raw_parameters = array()) { $this->routeName = $route_name; $this->route = $route; - $this->arguments = new ParameterBag($arguments); - $this->rawArguments = new ParameterBag($raw_arguments); + $this->parameters = new ParameterBag($parameters); + $this->rawParameters = new ParameterBag($raw_parameters); } /** @@ -77,7 +82,7 @@ public function getRouteObject() { * {@inheritdoc} */ public function getParameter($parameter_name) { - return $this->arguments->get($parameter_name); + return $this->parameters->get($parameter_name); } /** @@ -86,14 +91,14 @@ public function getParameter($parameter_name) { public function getParameters() { // A RouteMatch is constructed during routing, and should be immutable // after that, so return a clone to prevent callers from modifying. - return clone($this->arguments); + return clone($this->parameters); } /** * {@inheritdoc} */ public function getRawParameter($parameter_name) { - return $this->rawArguments->get($parameter_name); + return $this->rawParameters->get($parameter_name); } /** @@ -102,7 +107,7 @@ public function getRawParameter($parameter_name) { public function getRawParameters() { // A RouteMatch is constructed during routing, and should be immutable // after that, so return a clone to prevent callers from modifying. - return clone($this->rawArguments); + return clone($this->rawParameters); } } diff --git a/core/lib/Drupal/Core/Routing/RouteMatchInterface.php b/core/lib/Drupal/Core/Routing/RouteMatchInterface.php index d790bb8..e2fc534 100644 --- a/core/lib/Drupal/Core/Routing/RouteMatchInterface.php +++ b/core/lib/Drupal/Core/Routing/RouteMatchInterface.php @@ -7,6 +7,19 @@ namespace Drupal\Core\Routing; +/** + * Provides an interface for classes representing the result of routing. + * + * Routing is the process of selecting the best matching candidate from a + * collection of routes for an incoming request. The relevant properties of a + * request include the path as well as a list of raw parameter values derived + * from the URL. If an appropriate route is found, raw parameter values will be + * upcast automatically if possible. + * + * The route match object contains useful information about the selected route + * as well as the raw and upcast parameters derived from the incoming + * request. + */ interface RouteMatchInterface { /**