<commit_before><?php
declare(strict_types = 1);
/**
 * /src/Resource/UserResource.php
 *
 * @author TLe, <NAME> <<EMAIL>>
 */

namespace App\Resource;

use App\DTO\RestDtoInterface;
use App\DTO\User;
use App\Entity\EntityInterface;
use App\Entity\User as Entity;
use App\Entity\UserGroup;
use App\Repository\UserRepository as Repository;
use App\Rest\RestResource;
use App\Security\RolesService;
use Throwable;
use function array_filter;
use function array_values;
use function in_array;

/** @noinspection PhpHierarchyChecksInspection */
/** @noinspection PhpMissingParentCallCommonInspection */
/**
 * Class UserResource
 *
 * @package App\Resource
 * @author  TLe, <NAME> <<EMAIL>>
 *
 * @codingStandardsIgnoreStart
 *
 * @method Entity      getReference(string $id): Entity
 * @method Repository  getRepository(): Repository
 * @method Entity[]    find(?array $criteria = null, ?array $orderBy = null, ?int $limit = null, ?int $offset = null, ?array $search = null): array
 * @method Entity|null findOne(string $id, ?bool $throwExceptionIfNotFound = null): ?EntityInterface
 * @method Entity|null findOneBy(array $criteria, ?array $orderBy = null, ?bool $throwExceptionIfNotFound = null): ?EntityInterface
 * @method Entity      create(RestDtoInterface $dto, ?bool $flush = null, ?bool $skipValidation = null): EntityInterface
 * @method Entity      update(string $id, RestDtoInterface $dto, ?bool $flush = null, ?bool $skipValidation = null): EntityInterface
 * @method Entity      delete(string $id, ?bool $flush = null): EntityInterface
 * @method Entity      save(EntityInterface $entity, ?bool $flush = null, ?bool $skipValidation = null): EntityInterface
 *
 * @codingStandardsIgnoreEnd
 */
class UserResource extends RestResource
{
    /**
     * @var RolesService
     */
    private $rolesService;

    /**
     * Class constructor.
     *
     * @param Repository $repository
     * @param RolesService $rolesService
     */
    public function __construct(Repository $repository, RolesService $rolesService)
    {
        $this->setRepository($repository);
        $this->setDtoClass(User::class);
<commit_msg>refactor: Clean up for `UserResource` class.<commit_after><?php
declare(strict_types = 1);
/**
 * /src/Resource/UserResource.php
 *
 * @author TLe, <NAME> <<EMAIL>>
 */

namespace App\Resource;

use App\DTO\RestDtoInterface;
use App\Entity\EntityInterface;
use App\Entity\User as Entity;
use App\Entity\UserGroup;
use App\Repository\UserRepository as Repository;
use App\Rest\RestResource;
use App\Security\RolesService;
use Throwable;
use function array_filter;
use function array_values;
use function in_array;

/** @noinspection PhpHierarchyChecksInspection */
/** @noinspection PhpMissingParentCallCommonInspection */
/**
 * Class UserResource
 *
 * @package App\Resource
 * @author  TLe, <NAME> <<EMAIL>>
 *
 * @codingStandardsIgnoreStart
 *
 * @method Entity      getReference(string $id): Entity
 * @method Repository  getRepository(): Repository
 * @method Entity[]    find(?array $criteria = null, ?array $orderBy = null, ?int $limit = null, ?int $offset = null, ?array $search = null): array
 * @method Entity|null findOne(string $id, ?bool $throwExceptionIfNotFound = null): ?EntityInterface
 * @method Entity|null findOneBy(array $criteria, ?array $orderBy = null, ?bool $throwExceptionIfNotFound = null): ?EntityInterface
 * @method Entity      create(RestDtoInterface $dto, ?bool $flush = null, ?bool $skipValidation = null): EntityInterface
 * @method Entity      update(string $id, RestDtoInterface $dto, ?bool $flush = null, ?bool $skipValidation = null): EntityInterface
 * @method Entity      delete(string $id, ?bool $flush = null): EntityInterface
 * @method Entity      save(EntityInterface $entity, ?bool $flush = null, ?bool $skipValidation = null): EntityInterface
 *
 * @codingStandardsIgnoreEnd
 */
class UserResource extends RestResource
{
    /**
     * @var RolesService
     */
    private $rolesService;

    /**
     * Class constructor.
     *
     * @param Repository $repository
     * @param RolesService $rolesService
     */
    public function __construct(Repository $repository, RolesService $rolesService)
    {
        $this->setRepository($repository);

{'fraction_non_alphanumeric': 0.12198010421601137, 'fraction_numerical': 0.0004737091425864519, 'mean_word_length': 4.477302204928664, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 18, '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': '2620298', 'n_tokens_mistral': 1236, 'n_tokens_neox': 1233, 'n_words': 338}