PHP 8.3.31
Preview: CsvFileDumper.php Size: 1.34 KB
/home/getspomw/royalsquad.us/vendor/symfony/translation/Dumper/CsvFileDumper.php

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Translation\Dumper;

use Symfony\Component\Translation\MessageCatalogue;

/**
 * CsvFileDumper generates a csv formatted string representation of a message catalogue.
 *
 * @author Stealth35
 */
class CsvFileDumper extends FileDumper
{
    private string $delimiter = ';';
    private string $enclosure = '"';

    public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string
    {
        $handle = fopen('php://memory', 'r+');

        foreach ($messages->all($domain) as $source => $target) {
            fputcsv($handle, [$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.
     */
    public function setCsvControl(string $delimiter = ';', string $enclosure = '"'): void
    {
        $this->delimiter = $delimiter;
        $this->enclosure = $enclosure;
    }

    protected function getExtension(): string
    {
        return 'csv';
    }
}

Directory Contents

Dirs: 0 × Files: 13

Name Size Perms Modified Actions
1.34 KB lrw-rw-rw- 2025-09-17 06:53:19
Edit Download
742 B lrw-rw-rw- 2025-09-17 06:53:19
Edit Download
10.69 KB lrw-r--r-- 2026-04-26 10:16:36
Edit Download
3.40 KB lrw-rw-rw- 2025-09-17 06:53:19
Edit Download
2.84 KB lrw-rw-rw- 2025-09-17 06:53:19
Edit Download
950 B lrw-rw-rw- 2025-09-17 06:53:19
Edit Download
837 B lrw-rw-rw- 2025-09-17 06:53:18
Edit Download
2.19 KB lrw-rw-rw- 2025-09-17 06:53:19
Edit Download
792 B lrw-rw-rw- 2025-09-17 06:53:19
Edit Download
3.88 KB lrw-rw-rw- 2025-09-17 06:53:18
Edit Download
1.84 KB lrw-rw-rw- 2025-09-17 06:53:19
Edit Download
9.13 KB lrw-rw-rw- 2025-09-17 06:53:19
Edit Download
1.45 KB lrw-rw-rw- 2025-09-17 06:53:19
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).