You are here

public function CsvFileDumper::format in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/translation/Dumper/CsvFileDumper.php \Symfony\Component\Translation\Dumper\CsvFileDumper::format()

Transforms a domain of a message catalogue to its string representation.

Parameters

MessageCatalogue $messages:

string $domain:

Return value

string representation

Overrides FileDumper::format

File

vendor/symfony/translation/Dumper/CsvFileDumper.php, line 29

Class

CsvFileDumper
CsvFileDumper generates a csv formatted string representation of a message catalogue.

Namespace

Symfony\Component\Translation\Dumper

Code

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;
}