<commit_before><?php

/**
 * @file
 * Contains Drupal\Console\Command\EventsTrait.
 */

namespace Drupal\Console\Command;

use Symfony\Component\Console\Helper\HelperInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Yaml\Dumper;

trait ConfigExportTrait
{
    protected function getConfiguration($configName, $uuid = false)
    {
        // Unset uuid, maybe is not necessary to export
        $config = $this->configStorage->read($configName);

        if (!$uuid) {
            unset($config['uuid']);
        }

        return $config;
    }

    /**
     * string module name
     * @param OutputInterface $output
     */
    protected function exportConfig($module, OutputInterface $output)
    {
        $dumper = new Dumper();

        $output->writeln(
            sprintf(
                '[+] <info>%s</info>',
                $this->trans('commands.views.export.messages.view_exported')
            )
        );

        foreach ($this->configExport as $fileName => $config) {
            $yamlConfig = $dumper->dump($config['data'], 10);

            if ($config['optional']) {
                $configDirectory = $this->getSite()->getModuleConfigOptionalDirectory($module, false);
            } else {
                $configDirectory = $this->getSite()->getModuleConfigInstallDirectory($module, false);
            }

            $configFile = sprintf(
                '%s/%s.yml',
                $configDirectory,
                $fileName
            );

            $output->writeln(<commit_msg>Fix #947<commit_after><?php

/**
 * @file
 * Contains Drupal\Console\Command\ConfigExportTrait.
 */

namespace Drupal\Console\Command;

use Symfony\Component\Console\Helper\HelperInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Yaml\Dumper;

/**
 * Class ConfigExportTrait
 * @package Drupal\Console\Command
 */
trait ConfigExportTrait
{
    /**
     * @param $configName
     * @param bool|false $uuid
     * @return mixed
     */
    protected function getConfiguration($configName, $uuid = false)
    {
        // Unset uuid, maybe is not necessary to export
        $config = $this->configStorage->read($configName);

        if (!$uuid) {
            unset($config['uuid']);
        }

        return $config;
    }

    /**
     * @param $module
     * @param \Symfony\Component\Console\Output\OutputInterface $output
     */
    protected function exportConfig($module, OutputInterface $output)
    {
        $dumper = new Dumper();

        $output->writeln(
            sprintf(
                '[+] <info>%s</info>',
                $this->trans('commands.views.export.messages.view_exported')
            )
        );

        foreach ($this->configExport as $fileName => $config) {
            $yamlConfig = $dumper->dump($config['data'], 10);

            if ($config['optional']) {
                $configDirectory = $this->getSite()->getModuleConfigOptionalDirectory($module, false);
            } else {
                $configDirectory = $this->getSite()->getModuleConfigInstallDirectory($module, false);
            }

            $configFile = sprintf(
                '%s/%s.yml',
                $configDirectory,
                $fileName
            );

            $output->writeln(
{'fraction_non_alphanumeric': 0.1348314606741573, 'fraction_numerical': 0.0021257212268448226, 'mean_word_length': 2.0813844714686622, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4131526', 'n_tokens_mistral': 897, 'n_tokens_neox': 889, 'n_words': 160}