<commit_before><?php

use App\Models\Division;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Seeder;
use Illuminate\Support\Carbon;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\OutputInterface;

class FixturesTableSeeder extends Seeder
{
    public function run(): void
    {
        $divisions = Division::all();

        ProgressBar::setFormatDefinition('normal', '[%bar%] %percent:3s%%');
        $progressBar = new ProgressBar(new ConsoleOutput());
        $progressBar->start($divisions->count());

        /** @var Division $division */
        foreach ($divisions as $division) {
            $teams = $division->getTeams()->keyBy('id');

            $matchDate = Carbon::today()->setYear($division->getCompetition()->getSeason()->getYear());
            $matchNumber = 1;
            $progressBar->advance();
            foreach ($this->buildRounds($teams) as $round) {
                foreach ($round as $match) {
                    $matchTime = $this->setMatchTime($matchDate);

                    $homeTeam = $teams->get($match[0]);
                    $awayTeam = $teams->get($match[1]);

                    aFixture()
                        ->inDivision($division)
                        ->number($matchNumber++)
                        ->on($matchDate, $matchTime)
                        ->between($homeTeam, $awayTeam)
                        ->at($homeTeam->getVenue())
                        ->build();
                }
                $matchDate->addDay();
            };
        };
        $progressBar->finish();
        echo "\n";
    }

    private function setMatchTime(Carbon $matchDate): Carbon
    {
        if ($matchDate->isSunday()) {
            $matchDate->setTime(11, 30);
        } elseif ($matchDate->isSaturday()) {
            $matchDate->setTime(15, 00);
        } else {
            $matchDate->setTime(19, 45);
        }

        return $matchDate;
    }

    private function buildRounds(Collection $teams): Schedule
    {
        $rounds = (($count = count($teams)) % 2 === 0 ? $count - 1 : $count) * 2;
        $scheduler = new ScheduleBuilder($teams->keys()->toArray(), $rounds);

        return $scheduler->build();
    }
}
<commit_msg>Housekeeping: removed unused use statement<commit_after><?php

use App\Models\Division;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Seeder;
use Illuminate\Support\Carbon;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Output\ConsoleOutput;

class FixturesTableSeeder extends Seeder
{
    public function run(): void
    {
        $divisions = Division::all();

        ProgressBar::setFormatDefinition('normal', '[%bar%] %percent:3s%%');
        $progressBar = new ProgressBar(new ConsoleOutput());
        $progressBar->start($divisions->count());

        /** @var Division $division */
        foreach ($divisions as $division) {
            $teams = $division->getTeams()->keyBy('id');

            $matchDate = Carbon::today()->setYear($division->getCompetition()->getSeason()->getYear());
            $matchNumber = 1;
            $progressBar->advance();
            foreach ($this->buildRounds($teams) as $round) {
                foreach ($round as $match) {
                    $matchTime = $this->setMatchTime($matchDate);

                    $homeTeam = $teams->get($match[0]);
                    $awayTeam = $teams->get($match[1]);

                    aFixture()
                        ->inDivision($division)
                        ->number($matchNumber++)
                        ->on($matchDate, $matchTime)
                        ->between($homeTeam, $awayTeam)
                        ->at($homeTeam->getVenue())
                        ->build();
                }
                $matchDate->addDay();
            };
        };
        $progressBar->finish();
        echo "\n";
    }

    private function setMatchTime(Carbon $matchDate): Carbon
    {
        if ($matchDate->isSunday()) {
            $matchDate->setTime(11, 30);
        } elseif ($matchDate->isSaturday()) {
            $matchDate->setTime(15, 00);
        } else {
            $matchDate->setTime(19, 45);
        }

        return $matchDate;
    }

    private function buildRounds(Collection $teams): Schedule
    {
        $rounds = (($count = count($teams)) % 2 === 0 ? $count - 1 : $count) * 2;
        $scheduler = new ScheduleBuilder($teams->keys()->toArray(), $rounds);

        return $scheduler->build();
    }
}

{'fraction_non_alphanumeric': 0.1518655902247436, 'fraction_numerical': 0.008727907484180668, 'mean_word_length': 1.9824333116460637, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 63, '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': '6255819', 'n_tokens_mistral': 1318, 'n_tokens_neox': 1230, 'n_words': 226}