• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Message/ParamArray.php
  • Класс: BitrixImV2MessageParamArray
  • Вызов: ParamArray::addValue
public function addValue($value): self
{
	switch ($this->type)
	{
		case Param::TYPE_INT_ARRAY:
			$value = (int)$value;
			break;

		case Param::TYPE_STRING_ARRAY:
			$value = (string)$value;
	}

	foreach ($this as $param)
	{
		if ($param->getValue() === $value)
		{
			return $this;
		}
	}

	$param = new Param;
	$param
		->setName($this->getName())
		->setType($this->type == Param::TYPE_INT_ARRAY ? Param::TYPE_INT : Param::TYPE_STRING)
		->setValue($value)
	;

	if ($this->getMessageId())
	{
		$param->setMessageId($this->getMessageId());
	}

	if ($param->getPrimaryId())
	{
		$param->setRegistry($this);
	}
	else
	{
		$this['~'. $this->count()] = $param;
	}

	$this->markChanged();

	return $this;
}