• Модуль: location
  • Путь к файлу: ~/bitrix/modules/location/lib/entity/address/converter/stringtemplateconverter.php
  • Класс: BitrixLocationEntityAddressConverterStringTemplateConverter
  • Вызов: StringTemplateConverter::getErrorsText
private function getErrorsText(array $context): string
{
	$result = '';

	$errCodes = $this->getErrorCodes();
	foreach ($context['error']['errors'] as $errInfo)
	{
		$result .= "Error: {$errInfo['position']}, {$errCodes[$errInfo['code']]}" . PHP_EOL;
		if (!empty($errInfo['info']) && is_array($errInfo['info']))
		{
			$needHeader = true;
			foreach($errInfo['info'] as $paramName => $paramValue)
			{
				$needPrint = false;
				if (is_string($paramValue))
				{
					$paramValue = ""{$paramValue}"";
					$needPrint = true;
				}
				elseif (is_int($paramValue) || is_double($paramValue))
				{
					$needPrint = true;
				}
				elseif (is_bool($paramValue))
				{
					$paramValue = $paramValue ? 'true' : 'false';
					$needPrint = true;
				}
				elseif (is_array($paramValue))
				{
					$paramValue = '[...]';
					$needPrint = true;
				}
				elseif (is_object($paramValue))
				{
					$paramValue = '{...}';
					$needPrint = true;
				}
				if ($needPrint)
				{
					if ($needHeader)
					{
						$result .= "  Error info:" . PHP_EOL;
						$needHeader = false;
					}
					$result .= "    {$paramName}: {$paramValue}" . PHP_EOL;
				}
			}
		}
	}

	$result .= 'Template: "' . str_replace(["n", """], ['\n', '\"'], $context['template']) . '"'
		. PHP_EOL . PHP_EOL;

	return $result;
}