You are here

public function Route::__construct in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/routing/Route.php \Symfony\Component\Routing\Route::__construct()
  2. 8 vendor/symfony/routing/Annotation/Route.php \Symfony\Component\Routing\Annotation\Route::__construct()
  3. 8 core/modules/migrate/src/Plugin/migrate/process/Route.php \Drupal\migrate\Plugin\migrate\process\Route::__construct()
Same name and namespace in other branches
  1. 8.0 vendor/symfony/routing/Route.php \Symfony\Component\Routing\Route::__construct()

Constructor.

Available options:

  • compiler_class: A class name able to compile this route instance (RouteCompiler by default)

Parameters

string $path The path pattern to match:

array $defaults An array of default parameter values:

array $requirements An array of requirements for parameters (regexes):

array $options An array of options:

string $host The host pattern to match:

string|array $schemes A required URI scheme or an array of restricted schemes:

string|array $methods A required HTTP method or an array of restricted methods:

string $condition A condition that should evaluate to true for the route to match:

File

vendor/symfony/routing/Route.php, line 83

Class

Route
A Route describes a route and its parameters.

Namespace

Symfony\Component\Routing

Code

public function __construct($path, array $defaults = array(), array $requirements = array(), array $options = array(), $host = '', $schemes = array(), $methods = array(), $condition = '') {
  $this
    ->setPath($path);
  $this
    ->setDefaults($defaults);
  $this
    ->setRequirements($requirements);
  $this
    ->setOptions($options);
  $this
    ->setHost($host);

  // The conditions make sure that an initial empty $schemes/$methods does not override the corresponding requirement.
  // They can be removed when the BC layer is removed.
  if ($schemes) {
    $this
      ->setSchemes($schemes);
  }
  if ($methods) {
    $this
      ->setMethods($methods);
  }
  $this
    ->setCondition($condition);
}