<commit_before><?php

/**
 * Linna Framework.
 *
 * @author <NAME> <<EMAIL>>
 * @copyright (c) 2018, <NAME>
 * @license http://opensource.org/licenses/MIT MIT License
 */
declare(strict_types=1);

namespace Linna\Authorization;

use Linna\DataMapper\DomainObjectAbstract;

/**
 * Role.
 */
class Role extends DomainObjectAbstract
{
    use PermissionTrait;

    /**
     * @var string Group name
     */
    public $name;

    /**
     * @var string Group description
     */
    public $description;

    /**
     * @var int It say if group is active or not
     */
    public $active = 0;

    /**
     * @var array Contain users in group
     */
    private $users;

    /**
     * @var string Last update
     */
    public $lastUpdate;

    /**
     * Constructor.
     */
    public function __construct()
    {
        //set required type
        settype($this->objectId, 'integer');
        settype($this->active, 'integer');
    }

    /**
     * Set users in role.
     *
     * @param array $users
     */
    public function setUsers(array $users): void
    {
        $this->users = $users;
    }

    /**
     * Get users in role.
     *
     * @return array
     */
    public function getUsers(): array
    {
        return $this->users;
    }

    /**
     * Check if an user is in role.
     *
     * @param string $user
     *
     * @return bool
     */
    public function isUserInRole(string $user): bool
    {
        foreach ($this->users as $ownUser) {
            if ($ownUser->name === $user) {
                return true;
            }
        }

        return false;
    }
}
<commit_msg>set and get removed, default value added to properties<commit_after><?php

/**
 * Linna Framework.
 *
 * @author <NAME> <<EMAIL>>
 * @copyright (c) 2018, <NAME>
 * @license http://opensource.org/licenses/MIT MIT License
 */
declare(strict_types=1);

namespace Linna\Authorization;

use Linna\DataMapper\DomainObjectAbstract;

/**
 * Role.
 */
class Role extends DomainObjectAbstract
{
    use PermissionTrait;

    /**
     * @var string Group name
     */
    public $name = '';

    /**
     * @var string Group description
     */
    public $description = '';

    /**
     * @var int It say if group is active or not
     */
    public $active = 0;

    /**
     * @var array Contain users in group
     */
    private $users = [];

    /**
     * @var string Last update
     */
    public $lastUpdate = '';

    /**
     * Constructor.
     */
    public function __construct(array $users = [], array $permissions = [])
    {
        $this->users = $users;
        $this->permission = $permissions;

        //set required type
        settype($this->objectId, 'integer');
        settype($this->active, 'integer');
    }

    /**
     * Check if an user is in role.
     *
     * @param string $user
     *
     * @return bool
     */
    public function isUserInRole(string $user): bool
    {
        foreach ($this->users as $ownUser) {
            if ($ownUser->name === $user) {
                return true;
            }
        }

        return false;
    }
}

{'fraction_non_alphanumeric': 0.13648124191461836, 'fraction_numerical': 0.0038809831824062097, 'mean_word_length': 1.7864864864864864, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 23, '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': '5428181', 'n_tokens_mistral': 956, 'n_tokens_neox': 920, 'n_words': 249}