<commit_before><?php


namespace Octava\Bundle\BranchingBundle\Command;


use Doctrine\DBAL\Connection;
use Octava\Bundle\BranchingBundle\Manager\DumpManager;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class DumpCommand extends ContainerAwareCommand
{
    protected function configure()
    {
        $this
            ->setName('octava:branching:dump')
            ->setDescription('Create mysql dump file')
            ->addArgument('connection-name', InputArgument::REQUIRED, 'DBAL connection name.')
            ->addOption(
                'filename',
                'f',
                InputOption::VALUE_REQUIRED,
                'Dump dir. Default: %kernel.logs_dir%/<connection-name>.sql.tgz'
            )
            ->addOption(
                'ignore-tables',
                'i',
                InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
                'Ignore table list'
            )
            ->addOption(
                'create-ignore-tables-empty',
                null,
                InputOption::VALUE_REQUIRED,
                'Create ignore tables with no data'
            )
            ->addOption('dry-run', null, InputOption::VALUE_NONE, 'Execute commands as a dry run.');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $connectionId = sprintf('doctrine.dbal.default_connection', $input->getArgument('connection-name'));
        if (!$this->getContainer()->has($connectionId)) {
            throw new \RuntimeException(sprintf('Service connection "%s" not found', $connectionId));
        }

        /** @var Connection $connection */
        $connection = $this->getContainer()->get($connectionId);
        $filename = $input->getOption('filename');
        if (is_null($filename)) {
            $filename = sprintf(
                "%s/%s.sql.tgz",
                $this->getContainer()->getParameter('kernel.project_dir'),
                $connection->getDatabase()
            );
        }

        $this->getContainer()->get(DumpManager::class)
            ->run(
                $connection,
                $input->getOption('ignore-tables'),
                $input->getOption('create-ignore-tables-empty'),
                $filename,
                $input->getOption('dry-run')
            );
    }
}<commit_msg>rename dump options<commit_after><?php


namespace Octava\Bundle\BranchingBundle\Command;


use Doctrine\DBAL\Connection;
use Octava\Bundle\BranchingBundle\Manager\DumpManager;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class DumpCommand extends ContainerAwareCommand
{
    protected function configure()
    {
        $this
            ->setName('octava:branching:dump')
            ->setDescription('Create mysql dump file')
            ->addArgument('connection-name', InputArgument::REQUIRED, 'DBAL connection name.')
            ->addOption(
                'filename',
                'f',
                InputOption::VALUE_REQUIRED,
                'Dump dir. Default: %kernel.logs_dir%/<connection-name>.sql.tgz'
            )
            ->addOption(
                'ignore-table',
                'i',
                InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
                'Ignore table list'
            )
            ->addOption(
                'create-ignore-table-empty',
                null,
                InputOption::VALUE_REQUIRED,
                'Create ignore tables with no data'
            )
            ->addOption('dry-run', null, InputOption::VALUE_NONE, 'Execute commands as a dry run.');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $connectionId = sprintf('doctrine.dbal.default_connection', $input->getArgument('connection-name'));
        if (!$this->getContainer()->has($connectionId)) {
            throw new \RuntimeException(sprintf('Service connection "%s" not found', $connectionId));
        }

        /** @var Connection $connection */
        $connection = $this->getContainer()->get($connectionId);
        $filename = $input->getOption('filename');
        if (is_null($filename)) {
            $filename = sprintf(
                "%s/%s.sql.tgz",
                $this->getContainer()->getParameter('kernel.project_dir'),
                $connection->getDatabase()
            );
        }

        $this->getContainer()->get(DumpManager::class)
            ->run(
                $connection,
                $input->getOption('ignore-table'),
                $input->getOption('create-ignore-table-empty'),
                $filename,
                $input->getOption('dry-run')
            );
    }
}
{'fraction_non_alphanumeric': 0.1262211801484955, 'fraction_numerical': 0.0, 'mean_word_length': 2.104305639781686, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 49, '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': '2606543', 'n_tokens_mistral': 1337, 'n_tokens_neox': 1304, 'n_words': 222}