• Модуль: location
  • Путь к файлу: ~/bitrix/modules/location/lib/entity/address/converter/stringtemplateconverter.php
  • Класс: BitrixLocationEntityAddressConverterStringTemplateConverter
  • Вызов: StringTemplateConverter::parseGroup
private function parseGroup(array $context): array
{
	$startSearchPosition = $context['position'];
	$groupStartPosition = 0;
	$delimiterValue = '';
	$fieldValues = [];

	$context['level']++;

	// Checking for the presence of a start of a group
	$context = $this->parseGroupStart($context);

	if (!$context['hasError'])
	{
		// Found a sign of the beginning of a group
		$groupStartPosition = $context['info']['groupStartPosition'];
		$context['position'] = $context['info']['groupDelimiterStartPosition'];
		$context = $this->clearContextInfo($context);
		$context = $this->parseGroupDelimiter($context);
	}

	if (!$context['hasError'])
	{
		// The value of the group separator was got
		$delimiterValue = $context['info']['value'];
		$context = $this->clearContextInfo($context);
		$context = $this->parseGroupFieldListStart($context);
	}

	if (!$context['hasError'])
	{
		// The values of the field list was got
		$fieldValues = $context['info']['fieldValues'];
		$context = $this->clearContextInfo($context);
		$context = $this->parseGroupEnd($context);
	}

	if (!$context['hasError'])
	{
		// The sign of the end of the group is received, the assembly of the group value.
		$context['info'] = [
			'type' => 'group',
			'position' => $groupStartPosition,
			'end' => $context['position'],
			'value' => implode(
				$delimiterValue,
				array_unique(
					$fieldValues // Kremlin,Moscow,Moscow,Russia,103132 -> Kremlin,Moscow,Russia,103132
				)
			),
		];
	}

	$context['level']--;

	if ($context['hasError'])
	{
		$this->addContextError(
			$context,
			self::ERR_PARSE_GROUP,
			$startSearchPosition,
			['groupStartPosition' => $groupStartPosition]
		);
	}

	return $context;
}