Sets user activation state

0 = User is activated
1 = Awaits activation by mail
2 = Awaits activation by admin

@param int $state
553984
public function setState(int $state)
    {
        if ($state < 0 || $state > 2) {
            Throw new UserException('Users state value can be 0 (active), 1 (awaits activation by mail) or 2 (awaits activation by admin)');
        }

        $this->state = $state;
    }
496022
public function setCheck($check, $state)
    {
        if (array_key_exists($check, $this->meta->checks))
        {
            $this->meta->checks[$check] = $state;
        }
    }
1216565
public function setState($state)
    {
        $allowed_values = $this->getStateAllowableValues();
        if (!is_null($state) && !in_array($state, $allowed_values)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'state', must be one of '%s'",
                    implode("', '", $allowed_values)
                )
            );
        }
        $this->container['state'] = $state;

        return $this;
    }
1087120
public function setState($state)
    {
        if (!empty($state) && is_string($state) && ctype_print($state)) {
            $this->state = trim($state);
        }

        return $this;
    }
943458
public function setAllChecked($state)
    {
        foreach ($this->list as $id => $item) {
            $this->list[$id]['value'] = $state;
        }
    }
1194340
function setState($state) {
		if($state == (self::SWITCH_ACTUATOR_STATE_ON or self::SWITCH_ACTUATOR_STATE_OFF))
			$this->state = $state;
		else
			throw new \Exception('Invalid SwitchActuator state "'.$state.'"');
	}
372637
private function setStates(array $states)
    {
        foreach ($states as $state) {
            if (!is_string($state) || strlen($state) !== 1) {
                throw new \InvalidArgumentException(
                    'State must be a one character string'
                );
            }
        }

        $this->states = $states;
    }
1225640
private function verifyState($state)
    {
        $this->logger->debug('Verify parameter state.');
        $state = urldecode($state);
        $stateArray = [];
        parse_str($state, $stateArray);
        $token = $stateArray['token'];
        $token = preg_replace('~{~', '', $token, 1);
        $token = preg_replace('~}~', '', $token, 1);
        
        if ($token != $this->session->get(static::OPENID_SESSION_TOKEN)) {
            $this->logger->error('The value of the parameter STATE is not equal to the one which is expected');
            throw new SecurityException("The token is invalid.");
        }
    }
649899
public function setState($state)
    {
        if (!in_array($state, $this->validStates)) {
            throw new InvalidArgumentException("Invalid editor state: $state");
        }

        $this->state = $state;

        $this->session->put($this->statePersistenceKey, $state);

        return $this;
    }
697503
private function setOrderState($order, $state)
    {
        $prevState = $order->getState();
        if ($state == OrderModel::STATE_HOLDED) {
            // Ensure order is in one of the "can hold" states [STATE_NEW | STATE_PROCESSING]
            // to avoid no state on admin order unhold
            if ($prevState != OrderModel::STATE_NEW) {
                $order->setState(OrderModel::STATE_PROCESSING);
                $order->setStatus($order->getConfig()->getStateDefaultStatus(OrderModel::STATE_PROCESSING));
            }
            try {
                $order->hold();
            } catch (\Exception $e) {
                // Put the order in "on hold" state even if the previous call fails
                $order->setState(OrderModel::STATE_HOLDED);
                $order->setStatus($order->getConfig()->getStateDefaultStatus(OrderModel::STATE_HOLDED));
            }
        } elseif ($state == OrderModel::STATE_CANCELED) {
            try {
                $order->cancel();
                $order->setState(OrderModel::STATE_CANCELED);
                $order->setStatus($order->getConfig()->getStateDefaultStatus(OrderModel::STATE_CANCELED));
            } catch (\Exception $e) {
                // Put the order in "canceled" state even if the previous call fails
                $order->setState(OrderModel::STATE_CANCELED);
                $order->setStatus($order->getConfig()->getStateDefaultStatus(OrderModel::STATE_CANCELED));
            }
        } else {
            $order->setState($state);
            $order->setStatus($order->getConfig()->getStateDefaultStatus($state));
        }
    }
283942
protected function _setState($state)
    {
        if ($state !== null && !is_string($state) && !($state instanceof Stringable)) {
            throw $this->_createInvalidArgumentException(
                $this->__('Argument is not a valid state'),
                null,
                null,
                $state
            );
        }

        $this->state = $state;
    }
1264994
public function afterRegister($event, $user)
    {
        $sendMail = key_exists('sendMail', $event->data) ? $event->data['sendMail'] : true;
        if ($sendMail) {
            if (Configure::read('CM.ActivationOnRegister')) {
                $this->activation($user);
            }
        }
    }
6009
public final function enable($state = true){

		$old_state = $this->_enabled;

		$this->_enabled = (bool) $state;

		return $old_state;
	}
162683
public function sendActivationMail($user)
    {
        if ($user->activated || !$this->shouldSend($user)) {
            return;
        }
        $userToken = $this->createActivation($user);
        //$userToken = User::find($user->id);
        $user->notify(new ConfirmEmailNotification($userToken));
    }
245006
public function setUser($user)
    {
        if ($user instanceof User) {
            $this->_user = $user;
            return true;
        }
        $this->_user = null;
        return false;
    }
818671
public function setPlatformState(MaintenanceState $state)
    {
        if ($previous = $this->getDriver()->get(self::PREFIX . self::LAST_MODE)) {
            $currentState = new MaintenanceState(json_decode($previous, true));
            $currentState->setEndTime($state->getStartTime());
            $this->getDriver()->set(self::PREFIX . $currentState->getId(), json_encode($currentState->toArray()));

            $state->setId($currentState->getId() + 1);
        }


        $this->getDriver()->set(self::PREFIX . self::LAST_MODE, json_encode($state->toArray()));
    }
1277681
protected function _addState($state)
    {
        if (!is_string($state) && !($state instanceof Stringable)) {
            throw $this->_createInvalidArgumentException(
                $this->__('Argument is not a valid state.'),
                null,
                null,
                $state
            );
        }

        $this->states[(string) $state] = $state;
    }