class CsvFileDumper in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/translation/Dumper/CsvFileDumper.php \Symfony\Component\Translation\Dumper\CsvFileDumper
CsvFileDumper generates a csv formatted string representation of a message catalogue.
@author Stealth35
Hierarchy
- class \Symfony\Component\Translation\Dumper\FileDumper implements DumperInterface
- class \Symfony\Component\Translation\Dumper\CsvFileDumper
Expanded class hierarchy of CsvFileDumper
1 file declares its use of CsvFileDumper
- CsvFileDumperTest.php in vendor/
symfony/ translation/ Tests/ Dumper/ CsvFileDumperTest.php
File
- vendor/
symfony/ translation/ Dumper/ CsvFileDumper.php, line 21
Namespace
Symfony\Component\Translation\DumperView source
class CsvFileDumper extends FileDumper {
private $delimiter = ';';
private $enclosure = '"';
/**
* {@inheritdoc}
*/
public function format(MessageCatalogue $messages, $domain = 'messages') {
$handle = fopen('php://memory', 'rb+');
foreach ($messages
->all($domain) as $source => $target) {
fputcsv($handle, array(
$source,
$target,
), $this->delimiter, $this->enclosure);
}
rewind($handle);
$output = stream_get_contents($handle);
fclose($handle);
return $output;
}
/**
* Sets the delimiter and escape character for CSV.
*
* @param string $delimiter delimiter character
* @param string $enclosure enclosure character
*/
public function setCsvControl($delimiter = ';', $enclosure = '"') {
$this->delimiter = $delimiter;
$this->enclosure = $enclosure;
}
/**
* {@inheritdoc}
*/
protected function getExtension() {
return 'csv';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CsvFileDumper:: |
private | property | ||
CsvFileDumper:: |
private | property | ||
CsvFileDumper:: |
public | function |
Transforms a domain of a message catalogue to its string representation. Overrides FileDumper:: |
|
CsvFileDumper:: |
protected | function |
Gets the file extension of the dumper. Overrides FileDumper:: |
|
CsvFileDumper:: |
public | function | Sets the delimiter and escape character for CSV. | |
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. |