Set user status.

@param int $id - userId
@param string $presence - status
@param string $sessionId - session id

@throws InvalidArgumentException
@throws Exception
11099
public function setPresence($id, $presence, $sessionId)
    {
        if ($this->isEmptyId($id)) {
            throw new InvalidArgumentException;
        }

        if (!in_array($presence, User::getPresences())) {
            throw new InvalidArgumentException;
        }

        if (!$sessionId) {
            throw new InvalidArgumentException;
        }

        $params = [
            'presence' => $presence,
            'session' => $sessionId
        ];

        $this->call('users/' . $id . '/setpresence', $params, 'post');
    }
1220112
public function setSubscriptionId($subscriptionId)
    {
        if (strlen($subscriptionId) > 50) {
            throw new InvalidArgumentException("Subscription id cannot be longer than 50 characters");
        }
        if (preg_match('/[^a-zA-Z0-9_-]/', $subscriptionId)) {
            throw new InvalidArgumentException("Subscription id cannot contain special characters");
        }
        $this->parameters['subscription_id'] = $subscriptionId;
    }
121819
protected function _status($id, $status) {
		if (!$this->{$this->modelClass}->changeStatus($id, $status)) {
			return $this->alert('status.fail');
		}
		$this->alert('status.success');
	}
248199
public function setProps($id, $props, $isSystem = true)
    {
        if ($this->isEmptyId($id)) {
            throw new InvalidArgumentException;
        }

        if ($this->isEmptyProps($props)) {
            throw new InvalidArgumentException;
        }

        $params = [];
        if (!$isSystem) {
            $params['by_user_id'] = 'true';
        }

        $params['operations'] = [];

        if ($props) {
            foreach ($props as $key => $val) {
                $params['operations'][] = ['op' => 'update_or_create', 'key' => $key, 'value' => $val];
            }
        }

        $params['operations'] = json_encode($params['operations']);

        $this->call('users/' . $id . '/props', $params, 'post');
    }
1036136
public function setId($id)
    {
        $id = (string) $id;

        if (!preg_match('#^[a-zA-Z0-9_.]+$#', $id)) {
            throw new InvalidAlgorithmIdException($id);
        }

        $this->id = mb_strtolower($id);
    }
31283
public function setId($id)
    {
        if (isset($this->id)) {
            throw new InvalidCallException('Setting read-only property: ' . get_class($this) . '::id');
        }
        $this->id = $id;
    }
182589
public function set_id( $id ) {
		$this->id = $this->is_valid_id( $id ) ? $id : $this->generate_session_id();
	}
518959
public function setId(string $id = null): ButtonInterface
    {
        if ($this->isVisibility()) {
            $this->id = $id;
        }

        return $this;
    }
554269
public function setId($id)
    {
        if (!is_int($id) && !is_null($id)) {
            throw new \InvalidArgumentException(__CLASS__ . ' ' . __METHOD__ . ': Not an integer');
        }

        $this->id = $id;

        return $this;
    }
1064175
public function setDataEntry($id, $key, $value)
    {
        if (!isset($this->data[$id])) {
            throw new InvalidArgumentException("Missing row with ID $id.");
        }
        if (!$this->isDetached and $key === $this->mapper->getPrimaryKey($this->table)) { // mapper is always set when Result is not detached
            throw new InvalidArgumentException("ID can only be set in detached rows.");
        }
        $this->modified[$id][$key] = true;
        $this->data[$id][$key] = $value;
    }
755821
public function usersStatus($id, $status)
    {
        $statuses = ["free", "busy", "dinner", "break"];

        if (empty($status) || !in_array($status, $statuses)) {
            throw new \InvalidArgumentException(
                'Parameter `status` must be not empty & must be equal one of these values: free|busy|dinner|break'
            );
        }

        /** @noinspection PhpUndefinedMethodInspection */
        return $this->client->makeRequest(
            "/users/$id/status",
            "POST",
            ['status' => $status]
        );
    }
25031
private function _validateCustomerId($id = null)
    {
        if (empty($id) || trim($id) == "") {
            throw new InvalidArgumentException(
            'expected customer id to be set'
            );
        }
        if (!preg_match('/^[0-9A-Za-z_-]+$/', $id)) {
            throw new InvalidArgumentException(
            $id . ' is an invalid customer id.'
            );
        }

    }
443294
public function setVisibility(string $poiId, int $status)
    {
        if (!in_array($status, [0, 1], true)) {
            throw new InvalidArgumentException('status should be 0 or 1.');
        }

        return $this->httpPostJson('wxa/setnearbypoishowstatus', [
            'poi_id' => $poiId,
            'status' => $status,
        ]);
    }
328526
def get_userid_presence(self, user_id: str) -> UserPresence:
        
        return self._userid_to_presence.get(user_id, UserPresence.UNKNOWN)
844990
protected function changePageStatus($id, $status)
    {
        $object = $this->admin->getObject($id);

        if (!$object) {
            throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $id));
        }

        if (false === $this->admin->isGranted('EDIT', $object)) {
            throw new AccessDeniedException();
        }

        $this->admin->setSubject($object);

        $form = $this->admin->getForm();

        $object->setStatus($status);

        // persist if the form was valid and if in preview mode the preview was approved
        $this->admin->update($object);

        $this->get('session')->getFlashBag()->add('sonata_flash_success', $this->translate('flash_status_success'));

        return $this->redirect($this->admin->generateObjectUrl('edit', $object));
    }
506282
public function setStatus($id, $status)
    {
        if (!is_numeric($status)) {
            throw new Exception('Status argument must be an integer');
        }

        $entity = $this->findById($id)->firstOrFail();
        $entity->status = $status;
        $this->save($entity);

        return $entity;
    }
305994
public function setCurrentPageID($id)
    {
        $this->pageID = $id;
        $id = (int)$id;
        /** @deprecated */
        $this->getRequest()->getSession()->set($this->sessionNamespace() . ".currentPage", $id);
    }