<commit_before><?php

namespace App\GameBundle\Form\Type;

use App\Repository\GameRepository;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Translation\TranslatorInterface;

class ListGamesType extends AbstractType
{
    private $repository;
    private $translator;

    public function __construct(GameRepository $repository, TranslatorInterface $translator)
    {
        $this->repository = $repository;
        $this->translator = $translator;
    }

    /** @return array<string, int> */
    private function getList(): array
    {
        $games = $this->repository->getRecentGames(10, 1);
        $list = [];

        foreach ((array) $games as $game) {
            $teams = $game->getTeamNames();
            $transVsTeam = array_shift($teams);
            foreach ($teams as $team) {
                $transVsTeam .= ' vs. ' . $team;
            }
            $teams = $this->translator->trans('hittracker.game.list.vs_teams', [
                '{{id}}' => $game->getId(),
                '{{vs_team}}' => $transVsTeam,
            ]);

            $list[$teams] = $game->getId();
        }

        return $list;
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $list = $this->getList();
        $resolver->setDefaults([
            'choices' => $list,
            'choice_translation_domain' => false,
        ]);
    }

    public function getParent()
    {
        return ChoiceType::class;
    }<commit_msg>fix translation key name in ListGamesType<commit_after><?php

namespace App\GameBundle\Form\Type;

use App\Repository\GameRepository;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Translation\TranslatorInterface;

class ListGamesType extends AbstractType
{
    private $repository;
    private $translator;

    public function __construct(GameRepository $repository, TranslatorInterface $translator)
    {
        $this->repository = $repository;
        $this->translator = $translator;
    }

    /** @return array<string, int> */
    private function getList(): array
    {
        $games = $this->repository->getRecentGames(10, 1);
        $list = [];

        foreach ((array) $games as $game) {
            $teams = $game->getTeamNames();
            $transVsTeam = array_shift($teams);
            foreach ($teams as $team) {
                $transVsTeam .= ' vs. ' . $team;
            }
            $teams = $this->translator->trans('hittracker.game.list_vs_teams', [
                '{{id}}' => $game->getId(),
                '{{vs_team}}' => $transVsTeam,
            ]);

            $list[$teams] = $game->getId();
        }

        return $list;
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $list = $this->getList();
        $resolver->setDefaults([
            'choices' => $list,
            'choice_translation_domain' => false,
        ]);
    }

    public function getParent()
    {
        return ChoiceType::class;
    }
{'fraction_non_alphanumeric': 0.13451935081148564, 'fraction_numerical': 0.0018726591760299626, 'mean_word_length': 2.377239199157007, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6635409', 'n_tokens_mistral': 943, 'n_tokens_neox': 905, 'n_words': 173}