<commit_before><?php
/**
 * /src/App/Services/Helper/Roles.php
 *
 * @author  TLe, <NAME> <<EMAIL>>
 */
namespace App\Services\Helper;

/**
 * Class Roles
 *
 * @see /app/config/services_helper.yml
 *
 * @category    Service
 * @package     App\Services\Helper
 * @author      TLe, <NAME> <<EMAIL>>
 */
class Roles
{
    const ROLE_LOGGED   = 'ROLE_LOGGED';
    const ROLE_USER     = 'ROLE_USER';
    const ROLE_ADMIN    = 'ROLE_ADMIN';
    const ROLE_ROOT     = 'ROLE_ROOT';

    /**
     * Roles hierarchy.
     *
     * @var array
     */
    private $rolesHierarchy;

    /**
     * RolesHelper constructor.
     *
     * @param   array   $rolesHierarchy This is a 'security.role_hierarchy.roles' parameter value
     *
     * @return  Roles
     */
    public function __construct(array $rolesHierarchy)
    {
        $this->rolesHierarchy = $rolesHierarchy;
    }

    /**
     * Getter method to return all roles in single dimensional array.
     *
     * @return string[]
     */
    public function getRoles()
    {
        $roles = [
            self::ROLE_LOGGED,
            self::ROLE_USER,
            self::ROLE_ADMIN,
            self::ROLE_ROOT,
        ];

        return $roles;
    }

    /**
     * Getter method for role label.
     *
     * @param   string  $role
     *
     * @return  string
     */
    public function getRoleLabel($role)
    {
        switch ($role) {
            case self::ROLE_LOGGED:
                $output = 'Logged in users';
                break;
            case self::ROLE_USER:
                $output = 'Normal users';
                break;
            case self::ROLE_ADMIN:
                $output = 'Admin users';
                break;
            case self::ROLE_ROOT:
                $output = 'Root users';
                break;
            default:
                $output = 'Unknown - ' . $role;
                break;
        }

        return $output;
    }
}<commit_msg>Added getter method for short role.<commit_after><?php
/**
 * /src/App/Services/Helper/Roles.php
 *
 * @author  TLe, <NAME> <<EMAIL>>
 */
namespace App\Services\Helper;

/**
 * Class Roles
 *
 * @see /app/config/services_helper.yml
 *
 * @category    Service
 * @package     App\Services\Helper
 * @author      TLe, <NAME> <<EMAIL>>
 */
class Roles
{
    const ROLE_LOGGED   = 'ROLE_LOGGED';
    const ROLE_USER     = 'ROLE_USER';
    const ROLE_ADMIN    = 'ROLE_ADMIN';
    const ROLE_ROOT     = 'ROLE_ROOT';

    /**
     * Roles hierarchy.
     *
     * @var array
     */
    private $rolesHierarchy;

    /**
     * RolesHelper constructor.
     *
     * @param   array   $rolesHierarchy This is a 'security.role_hierarchy.roles' parameter value
     *
     * @return  Roles
     */
    public function __construct(array $rolesHierarchy)
    {
        $this->rolesHierarchy = $rolesHierarchy;
    }

    /**
     * Getter method to return all roles in single dimensional array.
     *
     * @return string[]
     */
    public function getRoles()
    {
        $roles = [
            self::ROLE_LOGGED,
            self::ROLE_USER,
            self::ROLE_ADMIN,
            self::ROLE_ROOT,
        ];

        return $roles;
    }

    /**
     * Getter method for role label.
     *
     * @param   string  $role
     *
     * @return  string
     */
    public function getRoleLabel($role)
    {
        switch ($role) {
            case self::ROLE_LOGGED:
                $output = 'Logged in users';
                break;
            case self::ROLE_USER:
                $output = 'Normal users';
                break;
            case self::ROLE_ADMIN:
                $output = 'Admin users';
                break;
            case self::ROLE_ROOT:
                $output = 'Root users';
                break;
            default:
                $output = 'Unknown - ' . $role;
                break;
        }

        return $output;
    }

    /**
     * Getter method for short role.
     *
     * @param   string $role
     *
     * @return  string
     */
    public function getShort($role)
    {
        return mb_strtolower(mb_substr($role, (mb_strpos($role, '_') + 1)));
    }
}
{'fraction_non_alphanumeric': 0.11713665943600868, 'fraction_numerical': 0.00024102193299590263, 'mean_word_length': 1.5182038834951457, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '6698821', 'n_tokens_mistral': 1336, 'n_tokens_neox': 1300, 'n_words': 278}