<commit_before><?php

namespace PHPhotoSuit\App\Command;

use PHPhotoSuit\PhotoSuite\Infrastructure\Persistence\SqliteConfig;
use PHPhotoSuit\PhotoSuite\Infrastructure\Persistence\SqlitePhotoRepository;
use PHPhotoSuit\PhotoSuite\Infrastructure\Persistence\SqlitePhotoThumbRepository;
use Symfony\Component\Console\Command\Command;
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 InitializeCommand extends Command
{
    protected function configure()
    {
        $this->setName('photosuit:init')
            ->setDescription('Initialize repository persistence.')
            ->addArgument(
                'driver',
                InputArgument::REQUIRED,
                'Which is the repository driver?(Available options: sqlite)'
            )
            ->addOption(
                'dbpath',
                null,
                InputOption::VALUE_REQUIRED,
                'SQLITE OPTION path where database is stored'
            );
    }
    
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $config = new SqliteConfig($input->getOption('dbpath'));
        $sqlitePhotoRepository = new SqlitePhotoRepository($config);
        $sqlitePhotoThumbRepository = new SqlitePhotoThumbRepository($config);
        
        $sqlitePhotoRepository->initialize();
        $sqlitePhotoThumbRepository->initialize();

        $output->writeln('Sqlite database tables successfully created!');
    }
}<commit_msg>Added init script command for mysql<commit_after><?php

namespace PHPhotoSuit\App\Command;

use Doctrine\Instantiator\Exception\InvalidArgumentException;
use PHPhotoSuit\App\Config\Repository;
use PHPhotoSuit\PhotoSuite\Infrastructure\Persistence\MysqlConfig;
use PHPhotoSuit\PhotoSuite\Infrastructure\Persistence\MysqlPhotoRepository;
use PHPhotoSuit\PhotoSuite\Infrastructure\Persistence\MysqlPhotoThumbRepository;
use PHPhotoSuit\PhotoSuite\Infrastructure\Persistence\SqliteConfig;
use PHPhotoSuit\PhotoSuite\Infrastructure\Persistence\SqlitePhotoRepository;
use PHPhotoSuit\PhotoSuite\Infrastructure\Persistence\SqlitePhotoThumbRepository;
use Symfony\Component\Console\Command\Command;
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 InitializeCommand extends Command
{
    protected function configure()
    {
        $this->setName('init')
            ->setDescription('Initialize repository persistence.')
            ->addArgument(
                'driver',
                InputArgument::REQUIRED,
                'Which is the repository driver?(Available options: sqlite)'
            )
            ->addOption(
                'dbpath',
                null,
                InputOption::VALUE_REQUIRED,
                'SQLITE OPTION path where database is stored'
            )
            ->addOption(
                'host',
                null,
                InputOption::VALUE_REQUIRED,
                'MYSQL OPTION database host'
            )
            ->addOption(
                'dbname',
                null,
                InputOption::VALUE_REQUIRED,
                'MYSQL OPTION database name'
            )
            ->addOption(
                'user',
                null,
                InputOption::VALUE_REQUIRED,
                'MYSQL OPTION database user'
            )
            ->addOption(
                'password',
                null,
                InputOption::VALUE_REQUIRED,
                'MYSQL OPTION database user'
            )
            ->addOption(
                'password',
                null,
                InputOption::VALUE_REQUIRED,
                'MYSQL OPTION database port'
            );
    }
    
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        switch ($input->getArgument('driver')) {
            case Repository::REPOSITORY_SQLITE:
                $config = new SqliteConfig($input->getOption('dbpath'));
                $sqlitePhotoRepository = new SqlitePhotoRepository($config);
                $sqlitePhotoThumbRepository = new SqlitePhotoThumbRepository($config);

                $sqlitePhotoRepository->initialize();
                $sqlitePhotoThumbRepository->initialize();

                $output->writeln('Sqlite database tables successfully created!');
                break;
            case Repository::REPOSITORY_MYSQL:
                $config = new MysqlConfig(
                    $input->getOption('host'),
                    $input->getOption('dbname'),
                    $input->getOption('user'),
                    $input->getOption('password'),
                    empty($input->getOption('port')) ? 3306 : $input->getOption('port')
                );
                $mysqlPhotoRepository = new MysqlPhotoRepository($config);
                $mysqlPhotoThumbRepository = new MysqlPhotoThumbRepository($config);

                $mysqlPhotoRepository->initialize();
                $mysqlPhotoThumbRepository->initialize();

                $output->writeln('Mysql database tables successfully created!');
                break;
            default:
                throw new InvalidArgumentException(sprintf('Invalid Driver %s', $input->getArgument('driver')));
                break;
        }

    }
}
{'fraction_non_alphanumeric': 0.09251259899208063, 'fraction_numerical': 0.0007199424046076314, 'mean_word_length': 2.1845272206303723, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, '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': '509391', 'n_tokens_mistral': 1388, 'n_tokens_neox': 1332, 'n_words': 240}