<commit_before><?php

/*
 * doctrine-repositories (https://github.com/juliangut/doctrine-repositories).
 * Doctrine2 utility repositories.
 *
 * @license MIT
 * @link https://github.com/juliangut/doctrine-repositories
 * @author <NAME> <<EMAIL>>
 */

namespace Jgut\Doctrine\Repository\Tests\Stubs;

use Doctrine\Common\Persistence\ObjectRepository;
use Doctrine\ORM\EntityManager;
use Jgut\Doctrine\Repository\Repository;
use Jgut\Doctrine\Repository\RepositoryTrait;

/**
 * Repository stub.
 */
class RepositoryStub implements Repository, ObjectRepository
{
    use RepositoryTrait;

    /**
     * @var EntityManager
     */
    protected $entityManager;

    /**
     * @var EntityDocumentStub[]
     */
    protected $entities;

    /**
     * RepositoryMock constructor.
     *
     * @param EntityManager $entityManager
     * @param array         $entities
     */
    public function __construct(EntityManager $entityManager, array $entities = [])
    {
        $this->entityManager = $entityManager;
        $this->entities = $entities;
    }

    /**
     * {@inheritdoc}
     */
    protected function getManager()
    {
        return $this->entityManager;
    }

    /**
     * {@inheritdoc}
     */
    public function getClassName()
    {
        return EntityDocumentStub::class;
    }

    /**
     * {@inheritdoc}
     */
    public function countAll()
    {
        return 100;
    }

    /**
     * {@inheritdoc}
     */
    public function find($id)
    {
        if (is_array($id)) {
            return $this->entities;
        }

        return isset($this->entities[$id]) ? $this->entities[$id] : null;
    }

    /**
     * {@inheritdoc}
     */
    public function findAll()
    {
        return $this->entities;
    }

    /**
     * {@inheritdoc}
     */
    public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
    {
        return $this->entities;
    }

    /**
     * {@inheritdoc}
     */
    public function findOneBy(array $criteria)
    {
        return count($this->entities) ? $this->entities[0] : null;
    }
}
<commit_msg>remove duplicated implements<commit_after><?php

/*
 * doctrine-repositories (https://github.com/juliangut/doctrine-repositories).
 * Doctrine2 utility repositories.
 *
 * @license MIT
 * @link https://github.com/juliangut/doctrine-repositories
 * @author <NAME> <<EMAIL>>
 */

namespace Jgut\Doctrine\Repository\Tests\Stubs;

use Doctrine\ORM\EntityManager;
use Jgut\Doctrine\Repository\Repository;
use Jgut\Doctrine\Repository\RepositoryTrait;

/**
 * Repository stub.
 */
class RepositoryStub implements Repository
{
    use RepositoryTrait;

    /**
     * @var EntityManager
     */
    protected $entityManager;

    /**
     * @var EntityDocumentStub[]
     */
    protected $entities;

    /**
     * RepositoryMock constructor.
     *
     * @param EntityManager $entityManager
     * @param array         $entities
     */
    public function __construct(EntityManager $entityManager, array $entities = [])
    {
        $this->entityManager = $entityManager;
        $this->entities = $entities;
    }

    /**
     * {@inheritdoc}
     */
    protected function getManager()
    {
        return $this->entityManager;
    }

    /**
     * {@inheritdoc}
     */
    public function getClassName()
    {
        return EntityDocumentStub::class;
    }

    /**
     * {@inheritdoc}
     */
    public function countAll()
    {
        return 100;
    }

    /**
     * {@inheritdoc}
     */
    public function find($id)
    {
        if (is_array($id)) {
            return $this->entities;
        }

        return isset($this->entities[$id]) ? $this->entities[$id] : null;
    }

    /**
     * {@inheritdoc}
     */
    public function findAll()
    {
        return $this->entities;
    }

    /**
     * {@inheritdoc}
     */
    public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
    {
        return $this->entities;
    }

    /**
     * {@inheritdoc}
     */
    public function findOneBy(array $criteria)
    {
        return count($this->entities) ? $this->entities[0] : null;
    }
}

{'fraction_non_alphanumeric': 0.13832090449843637, 'fraction_numerical': 0.0024055809477988932, 'mean_word_length': 2.191097467382962, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 29, 'https://': 4, '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': '2354725', 'n_tokens_mistral': 1278, 'n_tokens_neox': 1266, 'n_words': 233}