@param string $role

@throws \InvalidArgumentException
10475
public function setRoleUnauthenticated($role)
    {
        $role = (string) $role;
        if ($role === '') {
            throw new \InvalidArgumentException('$role cannot be empty');
        }

        $this->roleUnauthenticated = $role;
    }
1221673
public function addRole($role)
    {
        if (!$this->hasRole($role)) {
            $this->roles[] = strtoupper($role);
        }

        return $this;
    }
1094057
public function revokeRole($role)
    {
        if ($this->hasRole($role)) {
            unset($this->roles[$role]);
            return true;
        } else {
            return false;
        }
    }
1289678
public function addRole($role, array $resources = [])
    {
        if ($role instanceof RoleInterface) {
            $this->roles[$role->getName()] = $role;
        } else {
            $role = new Role($role, $resources);
            $this->roles[$role->getName()] = $role;
        }
    }
1124239
public function setAllowed($role = self::ALL, $resource = self::ALL, $privilege = self::ALL)
    {
        if ($this->policy == self::POLICY_ALLOW) {
            $this->permission->allow($role, $resource, $privilege);
        } else {
            $this->permission->deny($role, $resource, $privilege);
        }
    }
1021549
public function remove(Role $role)
    {
        if ($role->isReadOnly()) {
            throw new RoleReadOnlyException('This role cannot be removed');
        }

        $this->om->remove($role);
        $this->om->flush();
    }
1072967
public function removeRoleAction(Role $role)
    {
        $this->roleManager->remove($role);

        return new JsonResponse(
            array(
                'name' => $role->getName(),
                'limit' => $role->getMaxUsers(),
                'translationKey' => $role->getTranslationKey()
            )
        );
    }
1123857
public function addDatabaseReaderRole($role)
	{
		if (strlen($role) < 1) {
			throw new InvalidArgumentException("Role can't be empty");
		}
		$sec = $this->getSecurity();
		if (in_array($role, $sec->readers->roles)) {
			return true;
		}
		array_push($sec->readers->roles, $role);
		$back = $this->setSecurity($sec);
		if (is_object($back) && property_exists($back, "ok") && $back->ok == true) {
			return true;
		}
		return false;
	}
520736
public static function roleRevoke($role) {
		if (!empty($role) && !empty($_SESSION['numbers']['user']['roles'])) {
			if (!is_array($role)) $role = [$role];
			foreach ($role as $v) {
				$key = array_search($v, $_SESSION['numbers']['user']['roles']);
				if ($key !== false) {
					unset($_SESSION['numbers']['user']['roles'][$key]);
				}
			}
		}
	}
8297
public function isOne($role)
    {
        foreach ($this->getArrayFrom($role) as $role) {
            if ($this->hasRole($role)) {
                return true;
            }
        }

        return false;
    }
582569
public function hasOneRole($role)
    {
        foreach ($this->getArrayFrom($role) as $role) {
            if ($this->checkRole($role)) {
                return true;
            }
        }

        return false;
    }
637397
final protected function addRole(object $data, AbstractRole $role): BoundedRoleInterface
    {
        return new class ($role, $data) implements BoundedRoleInterface
        {
            use DelegatorTrait;

            public function __construct(AbstractRole $role, object $data)
            {
                if (false === $role->supports($data)) {
                    throw new InvalidArgumentException(
                        sprintf(
                            'Role "%s" does not support for current data',
                            get_class($role)
                        )
                    );
                }

                $this->attach($this->invoke($role, 'attach', $data));
            }

            /**
             * Extract data from bounded roles.
             *
             * @return object
             */
            public function extract(): object
            {
                return $this->invoke($this->getInstance(), 'extract');
            }

            /**
             * Invoke closure method from role.
             *
             * @param AbstractRole $role
             * @param string       $method
             * @param array        ...$args
             *
             * @return mixed
             */
            private function invoke(AbstractRole $role, string $method, ...$args)
            {
                $method = new ReflectionMethod(get_class($role), $method);
                $method->setAccessible(true);

                return $method->invoke($role, ...$args);
            }
        };
    }
395801
public function createRole(Role $role)
    {
        try {
            return $this->innerGateway->createRole($role);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
915744
public function all($role)
    {
        if (!is_string($role)) {
            throw new \InvalidArgumentException(sprintf('Expected $role of type string and got %s', gettype($role)));
        }

        if (!in_array(strtolower($role), array('member', 'contributor', 'admin'), true)) {
            throw new \InvalidArgumentException(sprintf('Unknown role %s', $role));
        }

        return $this->getClient()->setApiVersion('2.0')->get('teams', array('role' => $role));
    }
828740
public function addRole($role, $inherits = null)
    {
        if (is_string($role)) {
            $name = $role;
            $role = $this->createRole($name);
        } elseif ($role instanceof RoleInterface) {
            $name = $role->getName();
        } else {
            throw new \InvalidArgumentException('Role must be a string or implement RoleInterface');
        }

        if ($inherits) {

            if (!is_array($inherits)) {
                $inherits = [$inherits];
            }

            foreach ($inherits as $inherit) {
                $role->inherit($this->getRole($inherit));
            }
        }

        $this->roles[$name] = $role;
        return $role;
    }
356133
function resolve($role) {
        if($role instanceof \CharlotteDunois\Yasmin\Models\Role) {
            return $role;
        }
        
        if(\is_int($role)) {
            $role = (string) $role;
        }
        
        if(\is_string($role) && parent::has($role)) {
            return parent::get($role);
        }
        
        throw new \InvalidArgumentException('Unable to resolve unknown role');
    }
29133
public function removeRole($role)
    {
        $role = strtoupper($role);

        $roles = $this->roles;

        if (in_array($role, $roles)) {
            $remove[]    = $role;
            $this->roles = array_diff($roles, $remove);
        }

        return $this;
    }