protected function YamlFileLoader::validate in Zircon Profile 8
Same name in this branch
- 8 vendor/symfony/routing/Loader/YamlFileLoader.php \Symfony\Component\Routing\Loader\YamlFileLoader::validate()
- 8 vendor/symfony/dependency-injection/Loader/YamlFileLoader.php \Symfony\Component\DependencyInjection\Loader\YamlFileLoader::validate()
- 8 core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php \Drupal\Core\DependencyInjection\YamlFileLoader::validate()
Same name and namespace in other branches
- 8.0 vendor/symfony/routing/Loader/YamlFileLoader.php \Symfony\Component\Routing\Loader\YamlFileLoader::validate()
Validates the route configuration.
Parameters
array $config A resource config:
string $name The config key:
string $path The loaded file path:
Throws
\InvalidArgumentException If one of the provided config keys is not supported, something is missing or the combination is nonsense
1 call to YamlFileLoader::validate()
- YamlFileLoader::load in vendor/
symfony/ routing/ Loader/ YamlFileLoader.php - Loads a Yaml file.
File
- vendor/
symfony/ routing/ Loader/ YamlFileLoader.php, line 206
Class
- YamlFileLoader
- YamlFileLoader loads Yaml routing files.
Namespace
Symfony\Component\Routing\LoaderCode
protected function validate($config, $name, $path) {
if (!is_array($config)) {
throw new \InvalidArgumentException(sprintf('The definition of "%s" in "%s" must be a YAML array.', $name, $path));
}
if ($extraKeys = array_diff(array_keys($config), self::$availableKeys)) {
throw new \InvalidArgumentException(sprintf('The routing file "%s" contains unsupported keys for "%s": "%s". Expected one of: "%s".', $path, $name, implode('", "', $extraKeys), implode('", "', self::$availableKeys)));
}
if (isset($config['resource']) && isset($config['path'])) {
throw new \InvalidArgumentException(sprintf('The routing file "%s" must not specify both the "resource" key and the "path" key for "%s". Choose between an import and a route definition.', $path, $name));
}
if (!isset($config['resource']) && isset($config['type'])) {
throw new \InvalidArgumentException(sprintf('The "type" key for the route definition "%s" in "%s" is unsupported. It is only available for imports in combination with the "resource" key.', $name, $path));
}
if (!isset($config['resource']) && !isset($config['path'])) {
throw new \InvalidArgumentException(sprintf('You must define a "path" for the route "%s" in file "%s".', $name, $path));
}
}