<commit_before><?php

namespace App\Command;

use App\Repository\PersonRepository;
use App\Service\ChurchTools\Synchronizer;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ChoiceQuestion;

/**
 * Command to synchronize personal data upstream to churchtools.
 *
 * @author naitsirch <<EMAIL>>
 */
class ChurchtoolsSyncInteractiveCommand extends Command
{
    private EntityManagerInterface $entityManager;

    private Synchronizer $synchronizer;

    private PersonRepository $personRepo;

    public function __construct(
        EntityManagerInterface $entityManager,
        Synchronizer $synchronizer,
        PersonRepository $personRepo,
    ) {
        parent::__construct(null);

        $this->entityManager = $entityManager;
        $this->synchronizer = $synchronizer;
        $this->personRepo = $personRepo;
    }

    protected function configure()
    {
        $this
            ->setName('churchtools:sync:interactive')
            ->setDescription('Synchronize personal interactively from and to churchtools.')
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $output->writeln('');

        $comparedPersons = $issues = $namesOfCtPersonsWithoutDob = [];

        foreach ($this->synchronizer->iterateOverChurchtoolPersons() as $ctPerson) {
            if (!$ctPerson->getBirthday()) {
                $name = $ctPerson->getFirstName() . ' ' . $ctPerson->getLastName();
                $namesOfCtPersonsWithoutDob[] = $name;
                $issues[] = $msg = "$name is available in ChurchTools, but has no date of birth. "
                    . "A comparison is inappropriate, because different persons may have the same name. "
                    . "Date of birth is needed for automatic comparison. Please check manually.\n";
                $output->writeln("$msg\n---------------------------\n");
                continue;
            }

            $person = $this->personRepo->findOneOrNullByLastnameFirstnameAndDob(
                $ctPerson->getLastName(),
                $ctPerson->getFirstName(),
                new \DateTimeImmutable($ctPerson->getBirthday())
            );<commit_msg>Adjusted class name of ChurchTools sync command<commit_after><?php

namespace App\Command;

use App\Repository\PersonRepository;
use App\Service\ChurchTools\Synchronizer;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ChoiceQuestion;

/**
 * Command to synchronize personal data upstream to churchtools.
 *
 * @author naitsirch <<EMAIL>>
 */
class ChurchtoolsSyncCommand extends Command
{
    private EntityManagerInterface $entityManager;

    private Synchronizer $synchronizer;

    private PersonRepository $personRepo;

    public function __construct(
        EntityManagerInterface $entityManager,
        Synchronizer $synchronizer,
        PersonRepository $personRepo,
    ) {
        parent::__construct(null);

        $this->entityManager = $entityManager;
        $this->synchronizer = $synchronizer;
        $this->personRepo = $personRepo;
    }

    protected function configure()
    {
        $this
            ->setName('churchtools:sync')
            ->setDescription('Synchronize personal interactively from and to churchtools.')
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $output->writeln('');

        $comparedPersons = $issues = $namesOfCtPersonsWithoutDob = [];

        foreach ($this->synchronizer->iterateOverChurchtoolPersons() as $ctPerson) {
            if (!$ctPerson->getBirthday()) {
                $name = $ctPerson->getFirstName() . ' ' . $ctPerson->getLastName();
                $namesOfCtPersonsWithoutDob[] = $name;
                $issues[] = $msg = "$name is available in ChurchTools, but has no date of birth. "
                    . "A comparison is inappropriate, because different persons may have the same name. "
                    . "Date of birth is needed for automatic comparison. Please check manually.\n";
                $output->writeln("$msg\n---------------------------\n");
                continue;
            }

            $person = $this->personRepo->findOneOrNullByLastnameFirstnameAndDob(
                $ctPerson->getLastName(),
                $ctPerson->getFirstName(),
                new \DateTimeImmutable($ctPerson->getBirthday())
            );
{'fraction_non_alphanumeric': 0.11427980987807398, 'fraction_numerical': 0.0, 'mean_word_length': 2.663890991672975, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 41, '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': '5700264', 'n_tokens_mistral': 1278, 'n_tokens_neox': 1233, 'n_words': 280}