• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/Service/Timeline/Layout/Converter.php
  • Класс: Bitrix\Crm\Service\Timeline\Layout\Converter
  • Вызов: Converter::doConvert
protected function doConvert($value)
{
	if (is_array($value))
	{
		foreach ($value as $key => $item)
		{
			$value[$key] = $this->doConvert($item);
			if (is_null($value[$key]))
			{
				unset($value[$key]);
			}
		}
		if (empty($value))
		{
			$value = null;
		}
	}
	if ($value instanceof Layout\Base)
	{
		return $this->doConvert($value->toArray());
	}
	if ($value instanceof Date)
	{
		return $value->getTimestamp();
	}
	if ($value instanceof Uri)
	{
		return (string)$value;
	}
	if (is_object($value))
	{
		throw new NotSupportedException(
			'Class '
			. get_class($value)
			. ' must inherit \Bitrix\Crm\Service\Timeline\Layout\Base'
		);
	}

	return $value;
}