class YamlFileLoader in Plug 7
Same name in this branch
- 7 lib/Symfony/translation/Loader/YamlFileLoader.php \Symfony\Component\Translation\Loader\YamlFileLoader
- 7 lib/Symfony/validator/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php \Symfony\Component\Validator\Mapping\Loader\YamlFileLoader
YamlFileLoader loads translations from Yaml files.
@author Fabien Potencier <fabien@symfony.com>
@api
Hierarchy
- class \Symfony\Component\Translation\Loader\ArrayLoader implements LoaderInterface
- class \Symfony\Component\Translation\Loader\FileLoader
- class \Symfony\Component\Translation\Loader\YamlFileLoader
- class \Symfony\Component\Translation\Loader\FileLoader
Expanded class hierarchy of YamlFileLoader
1 file declares its use of YamlFileLoader
- YamlFileLoaderTest.php in lib/
Symfony/ translation/ Tests/ Loader/ YamlFileLoaderTest.php
1 string reference to 'YamlFileLoader'
- TranslatorTest::getTransFileTests in lib/
Symfony/ translation/ Tests/ TranslatorTest.php
File
- lib/
Symfony/ translation/ Loader/ YamlFileLoader.php, line 25
Namespace
Symfony\Component\Translation\LoaderView source
class YamlFileLoader extends FileLoader {
private $yamlParser;
/**
* {@inheritdoc}
*/
protected function loadResource($resource) {
if (null === $this->yamlParser) {
if (!class_exists('Symfony\\Component\\Yaml\\Parser')) {
throw new \LogicException('Loading translations from the YAML format requires the Symfony Yaml component.');
}
$this->yamlParser = new YamlParser();
}
try {
$messages = $this->yamlParser
->parse(file_get_contents($resource));
} catch (ParseException $e) {
throw new InvalidResourceException(sprintf('Error parsing YAML, invalid file "%s"', $resource), 0, $e);
}
return $messages;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ArrayLoader:: |
private | function | Flattens an nested array of translations. | |
FileLoader:: |
public | function |
@api Overrides ArrayLoader:: |
|
YamlFileLoader:: |
private | property | ||
YamlFileLoader:: |
protected | function |
Overrides FileLoader:: |