<commit_before><?php
namespace AnhNhan\ModHub\Modules\User\Query;

use AnhNhan\ModHub\Storage\Query;

/**
 * @author <NAME> <<EMAIL>>
 */
final class UserQuery extends Query
{
    const ENTITY_USER = 'AnhNhan\ModHub\Modules\User\Storage\User';
    const ENTITY_EMAIL = 'AnhNhan\ModHub\Modules\User\Storage\Email';

    /**
     * @return \AnhNhan\ModHub\Modules\User\Storage\User
     */
    public function retrieveUser($id)
    {
        return $this
            ->repository(self::ENTITY_USER)
            ->find($id)
        ;
    }

    public function retrieveUsersForIDs(array $ids, $limit = null, $offset = null)
    {
        $userRepo = $this->repository(self::ENTITY_USER);

        $users = $userRepo->findBy(array("id" => $ids), array(), $limit, $offset);
        return $users;
    }

    public function retrieveUsers($limit = null, $offset = null)
    {
        $userRepo = $this->repository(self::ENTITY_USER);

        $users = $userRepo->findBy(array(), array(), $limit = null, $offset = null);
        return $users;
    }

    public function retrieveUsersForNames(array $names, $limit = null, $offset = null)
    {
        $userRepo = $this->repository(self::ENTITY_USER);

        $users = $userRepo->findBy(array("username" => $names), array(), $limit, $offset);
        return $users;
    }

    public function retrieveUsersForCanonicalNames(array $names, $limit = null, $offset = null)
    {
        $userRepo = $this->repository(self::ENTITY_USER);

        $users = $userRepo->findBy(array("name_canon" => $names), array(), $limit, $offset);
        return $users;
    }

    // *************************************************************************
    //                                EMAIL
    // *************************************************************************

    public function retrieveEmailsForUIDs(array $ids, $limit = null, $offset = null)
    {
        return $this->repository(self::ENTITY_EMAIL)
            ->findBy(array("uid" => $ids), array("email" => "ASC"), $limit, $offset);<commit_msg>Uh, modernizing UserQuery<commit_after><?php
namespace AnhNhan\ModHub\Modules\User\Query;

use AnhNhan\ModHub\Storage\Query;

/**
 * @author <NAME> <<EMAIL>>
 */
final class UserQuery extends Query
{
    const ENTITY_USER = 'AnhNhan\ModHub\Modules\User\Storage\User';
    const ENTITY_EMAIL = 'AnhNhan\ModHub\Modules\User\Storage\Email';

    /**
     * @return \AnhNhan\ModHub\Modules\User\Storage\User
     */
    public function retrieveUser($id)
    {
        return idx($this->repository(self::ENTITY_USER)
            ->findBy(array("uid" => $id), array(), 1), 0);
    }

    public function retrieveUsersForUIDs(array $ids, $limit = null, $offset = null)
    {
        return $this->repository(self::ENTITY_USER)
            ->findBy(array("uid" => $ids), array(), $limit, $offset);
    }

    public function retrieveUsers($limit = null, $offset = null)
    {
        $userRepo = $this->repository(self::ENTITY_USER);

        $users = $userRepo->findBy(array(), array(), $limit, $offset);
        return $users;
    }

    public function retrieveUsersForNames(array $names, $limit = null, $offset = null)
    {
        $userRepo = $this->repository(self::ENTITY_USER);

        $users = $userRepo->findBy(array("username" => $names), array(), $limit, $offset);
        return $users;
    }

    public function retrieveUsersForCanonicalNames(array $names, $limit = null, $offset = null)
    {
        $userRepo = $this->repository(self::ENTITY_USER);

        $users = $userRepo->findBy(array("name_canon" => $names), array(), $limit, $offset);
        return $users;
    }

    // *************************************************************************
    //                                EMAIL
    // *************************************************************************

    public function retrieveEmailsForUIDs(array $ids, $limit = null, $offset = null)
    {
        return $this->repository(self::ENTITY_EMAIL)
            ->findBy(array("uid" => $ids), array("email" => "ASC"), $limit, $offset);
{'fraction_non_alphanumeric': 0.22014742014742014, 'fraction_numerical': 0.0004914004914004914, 'mean_word_length': 3.062874251497006, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 44, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2362939', 'n_tokens_mistral': 1235, 'n_tokens_neox': 1216, 'n_words': 231}