8000 [Routing] added hostname matching support to YamlFileLoader · symfony/symfony@cab450c · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit cab450c

Browse files
committed
[Routing] added hostname matching support to YamlFileLoader
1 parent 85d11af commit cab450c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Symfony/Component/Routing/Loader/YamlFileLoader.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
class YamlFileLoader extends FileLoader
2828
{
2929
private static $availableKeys = array(
30-
'type', 'resource', 'prefix', 'pattern', 'options', 'defaults', 'requirements'
30+
'type', 'resource', 'prefix', 'pattern', 'options', 'defaults', 'requirements', 'hostname_pattern',
3131
);
3232

3333
/**
@@ -70,9 +70,10 @@ public function load($file, $type = null)
7070
$defaults = isset($config['defaults']) ? $config['defaults'] : array();
7171
$requirements = isset($config['requirements']) ? $config['requirements'] : array();
7272
$options = isset($config['options']) ? $config['options'] : array();
73+
$hostnamePattern = isset($config['hostname_pattern']) ? $config['hostname_pattern'] : null;
7374

7475
$this->setCurrentDir(dirname($path));
75-
$collection->addCollection($this->import($config['resource'], $type, false, $file), $prefix, $defaults, $requirements, $options);
76+
$collection->addCollection($this->import($config['resource'], $type, false, $file), $prefix, $defaults, $requirements, $options, $hostnamePattern);
7677
} else {
7778
$this->parseRoute($collection, $name, $config, $path);
7879
}
@@ -106,12 +107,13 @@ protected function parseRoute(RouteCollection $collection, $name, $config, $file
106107
$defaults = isset($config['defaults']) ? $config['defaults'] : array();
107108
$requirements = isset($config['requirements']) ? $config['requirements'] : array();
108109
$options = isset($config['options']) ? $config['options'] : array();
110+
$hostnamePattern = isset($config['hostname_pattern']) ? $config['hostname_pattern'] : null;
109111

110112
if (!isset($config['pattern'])) {
111113
throw new \InvalidArgumentException(sprintf('You must define a "pattern" for the "%s" route.', $name));
112114
}
113115

114-
$route = new Route($config['pattern'], $defaults, $requirements, $options);
116+
$route = new Route($config['pattern'], $defaults, $requirements, $options, $hostnamePattern);
115117

116118
$collection->add($name, $route);
117119
}

0 commit comments

Comments
 (0)
0