Deletes the role.
@param string  $reason
@return \React\Promise\ExtendedPromiseInterface
435595
function delete(string $reason = '') {
        return (new \React\Promise\Promise(function (callable $resolve, callable $reject) use ($reason) {
            $this->client->apimanager()->endpoints->guild->deleteGuildRole($this->guild->id, $this->id, $reason)->done(function () use ($resolve) {
                $resolve();
            }, $reject);
        }));
    }
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;
    }
1008161
function delete(string $reason = '') {
        return (new \React\Promise\Promise(function (callable $resolve, callable $reject) use ($reason) {
            $this->client->apimanager()->endpoints->channel->deleteChannelPermission($this->channel->getId(), $this->id, $reason)->then(function () use ($resolve) {
                $resolve();
            }, $reject);
        }));
    }
714701
public function reject(Throwable $reason)
    {
        if (self::PENDING !== $this->state) {
            throw new PromiseAlreadyResolvedException('This promise is already resolved, and you\'re not allowed to resolve a promise more than once');
        }
        $this->state = self::REJECTED;
        $this->value = $reason;
        foreach ($this->subscribers as $subscriber) {
            $this->invokeCallback($subscriber[0], $subscriber[2]);
        }
    }
406552
public function deleteRole($roleId, $status = Role::STATUS_DEFINED)
    {
        $deleteRoleQuery = $this->handler->createDeleteQuery();
        if ($status !== Role::STATUS_DRAFT) {
            $deleteAssignmentsQuery = $this->handler->createDeleteQuery();
            $deleteAssignmentsQuery
                ->deleteFrom($this->handler->quoteTable('ezuser_role'))
                ->where(
                    $deleteAssignmentsQuery->expr->eq(
                        $this->handler->quoteColumn('role_id'),
                        $deleteAssignmentsQuery->bindValue($roleId, null, \PDO::PARAM_INT)
                    )
                );

            $draftCondition = $deleteRoleQuery->expr->eq(
                $this->handler->quoteColumn('version', 'ezrole'),
                $deleteRoleQuery->bindValue(Role::STATUS_DEFINED, null, \PDO::PARAM_INT)
            );
        } else {
            $draftCondition = $deleteRoleQuery->expr->neq(
                $this->handler->quoteColumn('version', 'ezrole'),
                $deleteRoleQuery->bindValue(Role::STATUS_DEFINED, null, \PDO::PARAM_INT)
            );
        }

        $deleteRoleQuery
            ->deleteFrom($this->handler->quoteTable('ezrole'))
            ->where(
                $deleteRoleQuery->expr->lAnd(
                    $deleteRoleQuery->expr->eq(
                        $this->handler->quoteColumn('id'),
                        $deleteRoleQuery->bindValue($roleId, null, \PDO::PARAM_INT)
                    ),
                    $draftCondition
                )
            );

        if ($status !== Role::STATUS_DRAFT) {
            $deleteAssignmentsQuery->prepare()->execute();
        }
        $deleteRoleQuery->prepare()->execute();
    }
1180934
public function stop($reason = 'Unkonwn reason')
    {
        $this->logger->info('Worker stop: ' . $reason);

        $this->triggerEvent(
            'onWorkerStop',
            [
                'worker' => $this,
                'reason' => $reason,
            ]
        );

        $this->setState(static::STATE_STOP);

        exit();
    }
1031330
public function deleteRoleActorAction(Request $request, Role $role, $actor)
    {
        $em = $this->getDoctrine()->getManager();
        $actor = $em->getRepository($this->get('core_manager')->getActorBundleName().':Actor')->findOneById($actor);
        
        $actor->getRolesCollection()->removeElement($role);
       
        $em->flush();
            
        $this->get('session')->getFlashBag()->add('success', 'role.deleted');

        if($request->query->get('redirect')!=''){
            return  $this->redirect($request->query->get('redirect'));
        }
        return $this->redirectToRoute('core_role_index');
    }
875119
public function delete(string $id = null)
    {
        $this->request->allowMethod(['post', 'delete']);
        $role = $this->Roles->get($id);
        if ($this->Roles->delete($role)) {
            $this->Flash->success((string)__('The role has been deleted.'));
        } else {
            $this->Flash->error((string)__('The role could not be deleted. Please, try again.'));
        }

        return $this->redirect(['action' => 'index']);
    }
766842
public function delete($key)
    {
        $role   =   $this->findByKey($key);
        if (! isset($role)) {
            return true;
        }

        return $role->delete();
    }
1364359
public function destroy(Role $role)
    {
        $role->delete();

        return intend([
            'url' => route('managerarea.roles.index'),
            'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/auth::common.role'), 'identifier' => $role->title])],
        ]);
    }
172376
public function removeRole($role)
    {
        $key = array_search(strtoupper($role), $this->roles, true);
        if (false !== $key) {
            /** @var string $key */
            unset($this->roles[$key]);
            $this->roles = array_values($this->roles);
        }

        return $this;
    }
777427
public function deleteAction(Request $request, Role $role): Response
    {
        $this->denyAccessUnlessGranted(new Attribute('role', 'delete'));
        $form = $this->formFactory->deleteRole(
            new RoleDeleteData($role)
        );
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (RoleDeleteData $data) {
                $role = $data->getRole();
                $this->roleService->deleteRole($role);

                $this->notificationHandler->success(
                    $this->translator->trans(
                        /** @Desc("Role '%role%' removed.") */
                        'role.delete.success',
                        ['%role%' => $role->identifier],
                        'role'
                    )
                );

                return new RedirectResponse($this->generateUrl('ezplatform.role.list'));
            });

            if ($result instanceof Response) {
                return $result;
            }
        }

        return $this->redirect($this->generateUrl('ezplatform.role.view', [
            'roleId' => $role->id,
        ]));
    }
1121480
public function removePermission(ChildPermission $permission)
    {
        if ($this->getPermissions()->contains($permission)) { $rolePermission = new ChildRolePermission();

            $rolePermission->setPermission($permission);
            if ($permission->isRolesLoaded()) {
                //remove the back reference if available
                $permission->getRoles()->removeObject($this);
            }

            $rolePermission->setRole($this);
            $this->removeRolePermission(clone $rolePermission);
            $rolePermission->clear();

            $this->collPermissions->remove($this->collPermissions->search($permission));

            if (null === $this->permissionsScheduledForDeletion) {
                $this->permissionsScheduledForDeletion = clone $this->collPermissions;
                $this->permissionsScheduledForDeletion->clear();
            }

            $this->permissionsScheduledForDeletion->push($permission);
        }


        return $this;
    }
538465
public function removeRole($role)
    {
        if ($this->instance instanceof \Phavour\Session\Storage) {
            if (!$this->hasRole($role)) {
                return false;
            }
            if ($this->instance->isLocked()) {
                $this->instance->unlock();
            }
            $roles = $this->instance->get('roles');
            if (is_array($roles)) {
                $new = array();
                foreach ($roles as $old) {
                    if ($old != $role) {
                        $new[] = $old;
                    }
                }
                $this->instance->set('roles', $new);
            }

            $this->instance->lock();
            return true;
        }

        return false;
    }
1240864
public function removeRole(string $role): GroupInterface
    {
        if (false !== $key = array_search(mb_strtoupper($role), $this->roles, true)) {
            unset($this->roles[$key]);
            $this->roles = array_values($this->roles);
        }

        return $this;
    }
703293
public function deleteMember($member, $reason = null, $silence = 0)
    {
        $request = new DeleteGroupMemberRequest($this->groupId, $member, $reason, $silence);
        $response = new BaseResponse();
        return $this->client->sendRequest($request, $response);
    }
582626
function remove($user = null) {
        if($user !== null) {
            $user = $this->client->users->resolve($user);
        }
        
        return (new \React\Promise\Promise(function (callable $resolve, callable $reject) use ($user) {
            $this->client->apimanager()->endpoints->channel
                ->deleteMessageUserReaction($this->message->channel->getId(), $this->message->id, $this->emoji->identifier, ($user !== null ? $user->id : '@me'))
                ->done(function () use ($resolve) {
                    $resolve($this);
                }, $reject);
        }));
    }