CsvFileDumper.php in Zircon Profile 8
File
vendor/symfony/translation/Dumper/CsvFileDumper.php
View source
<?php
namespace Symfony\Component\Translation\Dumper;
use Symfony\Component\Translation\MessageCatalogue;
class CsvFileDumper extends FileDumper {
private $delimiter = ';';
private $enclosure = '"';
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;
}
public function setCsvControl($delimiter = ';', $enclosure = '"') {
$this->delimiter = $delimiter;
$this->enclosure = $enclosure;
}
protected function getExtension() {
return 'csv';
}
}
Classes
Name |
Description |
CsvFileDumper |
CsvFileDumper generates a csv formatted string representation of a message catalogue. |