• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Message/Param.php
  • Класс: BitrixImV2MessageParam
  • Вызов: Param::setValue
public function setValue($value): self
{
	if ($value === null)
	{
		return $this->unsetValue();
	}

	switch ($this->type)
	{
		case self::TYPE_INT:
			$this->value = (int)$value;
			break;

		case self::TYPE_BOOL:
			if (is_string($value))
			{
				$this->value = $value === 'Y';
			}
			else
			{
				$this->value = (bool)$value;
			}
			break;

		case self::TYPE_STRING:
			$this->value = (string)$value;
			break;

		default:
			$this->value = $value;
	}

	$defaultValue = $this->getDefaultValue();
	if ($this->value === $defaultValue)
	{
		return $this->unsetValue();
	}

	$this->markChanged();

	return $this;
}