• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Message/Params.php
  • Класс: BitrixImV2MessageParams
  • Вызов: Params::initByArray
protected function initByArray(array $items): Result
{
	foreach ($items as $entityId => $entity)
	{
		if (is_array($entity) && isset($entity['PARAM_NAME']))
		{
			$paramName = $entity['PARAM_NAME'];
			if (!parent::offsetExists($paramName))
			{
				$this[$paramName] = self::create($paramName);
			}

			$item = $this[$paramName];
			if ($item instanceof ParamArray)
			{
				$type = self::getType($paramName);
				if (isset($type['classItem']))
				{
					$classItem = $type['classItem'];
					$item->add(new $classItem($entity));
				}
				else
				{
					$item->add(new Param($entity));
				}
			}
			else
			{
				$item->load($entity);
			}
		}
		else
		{
			if (!parent::offsetExists($entityId))
			{
				$this[$entityId] = self::create($entityId);
			}

			$this[$entityId]->setValue($entity);
		}
	}

	return new Result();
}