class YamlFileDumper in Plug 7
YamlFileDumper generates yaml files from a message catalogue.
@author Michel Salib <michelsalib@hotmail.com>
Hierarchy
- class \Symfony\Component\Translation\Dumper\FileDumper implements DumperInterface
- class \Symfony\Component\Translation\Dumper\YamlFileDumper
Expanded class hierarchy of YamlFileDumper
1 file declares its use of YamlFileDumper
- YamlFileDumperTest.php in lib/
Symfony/ translation/ Tests/ Dumper/ YamlFileDumperTest.php
File
- lib/
Symfony/ translation/ Dumper/ YamlFileDumper.php, line 23
Namespace
Symfony\Component\Translation\DumperView source
class YamlFileDumper extends FileDumper {
/**
* {@inheritdoc}
*/
protected function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) {
if (!class_exists('Symfony\\Component\\Yaml\\Yaml')) {
throw new \LogicException('Dumping translations in the YAML format requires the Symfony Yaml component.');
}
$data = $messages
->all($domain);
if (isset($options['as_tree']) && $options['as_tree']) {
$data = ArrayConverter::expandToTree($data);
}
if (isset($options['inline']) && ($inline = (int) $options['inline']) > 0) {
return Yaml::dump($data, $inline);
}
return Yaml::dump($data);
}
/**
* {@inheritdoc}
*/
protected function format(MessageCatalogue $messages, $domain) {
return $this
->formatCatalogue($messages, $domain);
}
/**
* {@inheritdoc}
*/
protected function getExtension() {
return 'yml';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FileDumper:: |
private | property | Make file backup before the dump. | |
FileDumper:: |
protected | property | A template for the relative paths to files. | 1 |
FileDumper:: |
public | function |
Dumps the message catalogue. Overrides DumperInterface:: |
1 |
FileDumper:: |
private | function | Gets the relative file path using the template. | |
FileDumper:: |
public | function | Sets backup flag. | |
FileDumper:: |
public | function | Sets the template for the relative paths to files. | |
YamlFileDumper:: |
protected | function |
Transforms a domain of a message catalogue to its string representation. Overrides FileDumper:: |
|
YamlFileDumper:: |
protected | function |
Transforms a domain of a message catalogue to its string representation. Overrides FileDumper:: |
|
YamlFileDumper:: |
protected | function |
Gets the file extension of the dumper. Overrides FileDumper:: |