You are here

protected function YamlFileLoader::parseRoute in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/routing/Loader/YamlFileLoader.php \Symfony\Component\Routing\Loader\YamlFileLoader::parseRoute()

Parses a route and adds it to the RouteCollection.

Parameters

RouteCollection $collection A RouteCollection instance:

string $name Route name:

array $config Route definition:

string $path Full path of the YAML file being processed:

1 call to YamlFileLoader::parseRoute()
YamlFileLoader::load in vendor/symfony/routing/Loader/YamlFileLoader.php
Loads a Yaml file.

File

vendor/symfony/routing/Loader/YamlFileLoader.php, line 119

Class

YamlFileLoader
YamlFileLoader loads Yaml routing files.

Namespace

Symfony\Component\Routing\Loader

Code

protected function parseRoute(RouteCollection $collection, $name, array $config, $path) {
  $defaults = isset($config['defaults']) ? $config['defaults'] : array();
  $requirements = isset($config['requirements']) ? $config['requirements'] : array();
  $options = isset($config['options']) ? $config['options'] : array();
  $host = isset($config['host']) ? $config['host'] : '';
  $schemes = isset($config['schemes']) ? $config['schemes'] : array();
  $methods = isset($config['methods']) ? $config['methods'] : array();
  $condition = isset($config['condition']) ? $config['condition'] : null;
  if (isset($requirements['_method'])) {
    if (0 === count($methods)) {
      $methods = explode('|', $requirements['_method']);
    }
    unset($requirements['_method']);
    @trigger_error(sprintf('The "_method" requirement of route "%s" in file "%s" is deprecated since version 2.2 and will be removed in 3.0. Use the "methods" option instead.', $name, $path), E_USER_DEPRECATED);
  }
  if (isset($requirements['_scheme'])) {
    if (0 === count($schemes)) {
      $schemes = explode('|', $requirements['_scheme']);
    }
    unset($requirements['_scheme']);
    @trigger_error(sprintf('The "_scheme" requirement of route "%s" in file "%s" is deprecated since version 2.2 and will be removed in 3.0. Use the "schemes" option instead.', $name, $path), E_USER_DEPRECATED);
  }
  $route = new Route($config['path'], $defaults, $requirements, $options, $host, $schemes, $methods, $condition);
  $collection
    ->add($name, $route);
}