public function Route::setRequirement

Sets a requirement for the given key.

@api

Parameters

string $key The key:

string $regex The regex:

Return value

Route The current Route instance

File

drupal/core/vendor/symfony/routing/Symfony/Component/Routing/Route.php, line 538

Class

Route
A Route describes a route and its parameters.

Namespace

Symfony\Component\Routing

Code

public function setRequirement($key, $regex) {
  $this->requirements[$key] = $this
    ->sanitizeRequirement($key, $regex);
  $this->compiled = null;
  return $this;
}