Nette\Security\Permission::checkRole PHP Method

checkRole() private method

Checks whether Role is valid and exists in the list.
private checkRole ( $role, $need = TRUE ) : void
return void
    private function checkRole($role, $need = TRUE)
    {
        if (!is_string($role) || $role === '') {
            throw new Nette\InvalidArgumentException('Role must be a non-empty string.');
        } elseif ($need && !isset($this->roles[$role])) {
            throw new Nette\InvalidStateException("Role '{$role}' does not exist.");
        }
    }