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/Annotation/Route.php \Symfony\Component\Routing\Annotation\Route::__construct()

Constructor.

Parameters

array $data An array of key/value parameters.:

Throws

\BadMethodCallException

File

vendor/symfony/routing/Annotation/Route.php, line 41

Class

Route
Annotation class for @Route().

Namespace

Symfony\Component\Routing\Annotation

Code

public function __construct(array $data) {
  if (isset($data['value'])) {
    $data['path'] = $data['value'];
    unset($data['value']);
  }
  foreach ($data as $key => $value) {
    $method = 'set' . str_replace('_', '', $key);
    if (!method_exists($this, $method)) {
      throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, get_class($this)));
    }
    $this
      ->{$method}($value);
  }
}