public function FileDumper::dump in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/translation/Dumper/FileDumper.php \Symfony\Component\Translation\Dumper\FileDumper::dump()
Dumps the message catalogue.
Parameters
MessageCatalogue $messages The message catalogue:
array $options Options that are used by the dumper:
Overrides DumperInterface::dump
1 call to FileDumper::dump()
- XliffFileDumper::dump in vendor/
symfony/ translation/ Dumper/ XliffFileDumper.php - Dumps the message catalogue.
1 method overrides FileDumper::dump()
- XliffFileDumper::dump in vendor/
symfony/ translation/ Dumper/ XliffFileDumper.php - Dumps the message catalogue.
File
- vendor/
symfony/ translation/ Dumper/ FileDumper.php, line 64
Class
- FileDumper
- FileDumper is an implementation of DumperInterface that dump a message catalogue to file(s). Performs backup of already existing files.
Namespace
Symfony\Component\Translation\DumperCode
public function dump(MessageCatalogue $messages, $options = array()) {
if (!array_key_exists('path', $options)) {
throw new \InvalidArgumentException('The file dumper needs a path option.');
}
// save a file for each domain
foreach ($messages
->getDomains() as $domain) {
// backup
$fullpath = $options['path'] . '/' . $this
->getRelativePath($domain, $messages
->getLocale());
if (file_exists($fullpath)) {
if ($this->backup) {
copy($fullpath, $fullpath . '~');
}
}
else {
$directory = dirname($fullpath);
if (!file_exists($directory) && !@mkdir($directory, 0777, true)) {
throw new \RuntimeException(sprintf('Unable to create directory "%s".', $directory));
}
}
// save file
file_put_contents($fullpath, $this
->format($messages, $domain));
}
}