PHP 8.3.31
Preview: YamlFileDumper.php Size: 1.45 KB
/home/getspomw/royalsquad.us/vendor/symfony/translation/Dumper/YamlFileDumper.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\Exception\LogicException;
use Symfony\Component\Translation\MessageCatalogue;
use Symfony\Component\Translation\Util\ArrayConverter;
use Symfony\Component\Yaml\Yaml;

/**
 * YamlFileDumper generates yaml files from a message catalogue.
 *
 * @author Michel Salib <michelsalib@hotmail.com>
 */
class YamlFileDumper extends FileDumper
{
    public function __construct(
        private string $extension = 'yml',
    ) {
    }

    public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string
    {
        if (!class_exists(Yaml::class)) {
            throw new LogicException('Dumping translations in the YAML format requires the Symfony Yaml component.');
        }

        $data = $messages->all($domain);

        if (isset($options['as_tree']) && $options['as_tree']) {
            $data = ArrayConverter::expandToTree($data);
        }

        if (isset($options['inline']) && ($inline = (int) $options['inline']) > 0) {
            return Yaml::dump($data, $inline);
        }

        return Yaml::dump($data);
    }

    protected function getExtension(): string
    {
        return $this->extension;
    }
}

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).