Gets the role the member is hoisted with.
@return \CharlotteDunois\Yasmin\Models\Role|null
428874
function getHoistRole() {
        $roles = $this->roles->filter(function ($role) {
            return $role->hoist;
        });
        
        if($roles->count() === 0) {
            return null;
        }
        
        return $roles->reduce(function ($prev, $role) {
            if($prev === null) {
                return $role;
            }
            
            return ($role->comparePositionTo($prev) > 0 ? $role : $prev);
        });
    }
581092
public function getRole( $identifier )
    {
         /** @var \eZ\Publish\API\Repository\Repository $repository */
        $repository = $this->getRepository();
        $role = $repository->sudo(
            function() use( $repository, $identifier )
            {
                $role = null;
                $roleService = $repository->getRoleService();
                try
                {
                    // make sure role name starts with uppercase as this is what default setup provides
                    if ($identifier !== ucfirst($identifier)) {
                        @trigger_error(
                            "'{$identifier}' role name should start with uppercase letter",
                            E_USER_DEPRECATED
                        );
                    }
                    $role = $roleService->loadRoleByIdentifier(ucfirst($identifier));
                }
                catch ( ApiExceptions\NotFoundException $e )
                {
                    // Role not found, do nothing, returns null
                }

                return $role;
            }
        );

        return $role;
    }
355656
public function getPeriod($role = null) {
        $roles = $this->_get('roles');
        if (!isset($roles[$role])) {
            if ($role === null) {
                return null;
            }
            return $this->getPeriod();
        }
        return (int) $roles[$role]['period'];
    }
309277
private static function get_role( $role ) {
		global $wp_roles;

		$role_obj = $wp_roles->get_role( $role );

		if ( ! $role_obj ) {
			WP_CLI::error( "'{$role}' role not found." );
		}

		return $role_obj;
	}
458502
public function roles()
    {
        return $this->belongsToMany(
            Config::get('laratrust.models.role'),
            Config::get('laratrust.tables.permission_role'),
            Config::get('laratrust.foreign_keys.permission'),
            Config::get('laratrust.foreign_keys.role')
        );
    }
271745
public function getMentionRolesAttribute()
    {
        $roles = new Collection([], 'id');

        foreach ($this->channel->guild->roles as $role) {
            if (array_search($role->id, $this->attributes['mention_roles']) !== false) {
                $roles->push($role);
            }
        }

        return $roles;
    }
372420
public function roles()
    {
        $relation = $this->morphToMany(
            Models::classname(Role::class),
            'entity',
            Models::table('assigned_roles')
        )->withPivot('scope');

        return Models::scope()->applyToRelation($relation);
    }
1267845
public function roles()
    {
        return $this->belongsToMany(
            Config::get('ntrust.profiles.' . self::$roleProfile . '.role'), 
            Config::get('ntrust.profiles.' . self::$roleProfile . '.role_user_table'), 
            Config::get('ntrust.profiles.' . self::$roleProfile . '.user_foreign_key'), 
            Config::get('ntrust.profiles.' . self::$roleProfile . '.role_foreign_key'));
    }
1116771
protected function getListRole()
    {
        $id = $this->getParam(0);

        if (!isset($id)) {
            return $this->role->getList(array('limit' => $this->getLimit()));
        }

        if (empty($id) || !is_numeric($id)) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        $result = $this->role->get($id);

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        return array($result);
    }
1073330
public function checkRole( $role, $parent = null )
    {
        if ( null === $role )
        {
            return null;
        }

        if ( $role instanceof Acl\Role\RoleInterface )
        {
            $role = $role->getRoleId();
        }

        $acl = $this->getAcl();

        if ( ! $acl->hasRole( $role ) )
        {
            if ( null === $parent )
            {
                $parent = $this->getParentId( $role );
            }
            elseif ( $parent instanceof Acl\Role\RoleInterface )
            {
                $parent = $parent->getRoleId();
            }

            $parent = $this->checkRole( $parent );
            $acl->addRole( $role, (array) $parent );

            $matches    = array();
            $structures = array();

            if ( preg_match( '/^(\d+)$/', $role, $matches ) ) //group
            {
                $structures = $this->getMapper()
                                   ->findAllByGroupId( $matches[1] );
            }
            else if ( preg_match( '/^(\d+)\.(\d+)$/', $role, $matches ) ) //user
            {
                $structures = $this->getMapper()
                                   ->findAllByUserId( $matches[2] );

                $resource = 'user.group.' . $matches[1] .
                            '.identity.' . $matches[2];

                $this->checkResource( $resource );
                $acl->allow( $role, $resource );
            }

            foreach ( $structures as $structure )
            {
                $this->checkResource( $structure->resource );
                $acl->allow( $role, $structure->resource, $structure->privilege );
            }
        }

        return $role;
    }
745829
private function getRoleRepository()
    {
        if (null === $this->roleRepo) {
            $this->roleRepo = $this->getRepository(RoleInterface::class);
        }

        return $this->roleRepo;
    }
296961
public function getRoles()
    {
        $roles = array();
        foreach ($this->groups as $group) {
            $roles[] = $group->getAsRole();
        }
        $roles[] = 'ROLE_USER';
        return $roles;
    }
1231727
public static function get_user_role($user = null)
    {
        $wp_roles = \wp_roles();

        if ($user === null) {
            $user = \wp_get_current_user();
        }

        if (!($user instanceof WP_User)) {
            return false;
        }

        $roles = $user->roles;
        $role = \array_shift($roles);

        return isset($wp_roles->role_objects[ $role ]) ? $wp_roles->role_objects[ $role ] : false;
    }
984444
public function getDrupalRoleList()
    {
        if (null === $this->roleListCache) {
            $this->roleListCache = $this->db->query("SELECT rid, name FROM {role} ORDER BY rid")->fetchAllKeyed();
        }

        return $this->roleListCache;
    }
885436
public function getRoles()
    {
        if (count($this->rolesStringAsArray) > 0) {
            return $this->rolesStringAsArray;
        }

        $roleNames = array();

        foreach ($this->getEntityRoles(true) as $role) {
            $roleNames[] = $role->getName();
        }

        return $roleNames;
    }
1069773
function roles()
    {
        $groups = $this->attribute( 'groups' );
        $groups[] = $this->attribute( 'contentobject_id' );
        return eZRole::fetchByUser( $groups );
    }
442795
@Override
    public Role getRole() {
        return is(NodeFlag.MASTER) ? Role.MASTER : Role.SLAVE;
    }