<commit_before><?php

namespace AppBundle\Repository;

use AppBundle\Entity\Game;
use AppBundle\Entity\League;
use AppBundle\Entity\Player;
use AppBundle\Entity\Result;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;

/**
 * GameRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class GameRepository extends EntityRepository
{
    public function getAllGames(): ArrayCollection
    {
        $allGames = $this->findBy([], ['date' => 'DESC']);
        return new ArrayCollection($allGames);
    }

    public function getLeagueGames(League $league): ArrayCollection
    {
        $qb = $this->createQueryBuilder('g')
            ->where('g.date > :startDate')
            ->setParameter('startDate', $league->getStartDate()->sub(new \DateInterval('P1D')));
        if ($league->getEndDate() !== null) {
            $qb->andWhere('g.date <= :endDate')
                ->setParameter('endDate', $league->getEndDate());
        }
        $leagueGames = $qb->getQuery()->getResult();

        return new ArrayCollection($leagueGames);
    }<commit_msg>sort ordering<commit_after><?php

namespace AppBundle\Repository;

use AppBundle\Entity\Game;
use AppBundle\Entity\League;
use AppBundle\Entity\Player;
use AppBundle\Entity\Result;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;

/**
 * GameRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class GameRepository extends EntityRepository
{
    public function getAllGames(): ArrayCollection
    {
        $allGames = $this->findBy([], ['date' => 'DESC']);
        return new ArrayCollection($allGames);
    }

    public function getLeagueGames(League $league): ArrayCollection
    {
        $qb = $this->createQueryBuilder('g')
            ->where('g.date > :startDate')
            ->setParameter('startDate', $league->getStartDate()->sub(new \DateInterval('P1D')));
        if ($league->getEndDate() !== null) {
            $qb->andWhere('g.date <= :endDate')
                ->setParameter('endDate', $league->getEndDate());
        }
        $qb->addOrderBy('g.date', 'DESC');
        $leagueGames = $qb->getQuery()->getResult();

        return new ArrayCollection($leagueGames);
    }
{'fraction_non_alphanumeric': 0.143986683312526, 'fraction_numerical': 0.0008322929671244278, 'mean_word_length': 3.370909090909091, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 32, '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': '6071294', 'n_tokens_mistral': 709, 'n_tokens_neox': 685, 'n_words': 147}