• Модуль: rest
  • Путь к файлу: ~/bitrix/modules/rest/lib/configuration/dataprovider/providerbase.php
  • Класс: BitrixRestConfigurationDataProviderProviderBase
  • Вызов: ProviderBase::get
public function get(string $path, int $step): ?array;

/**
 * Returns structured content for working
 * @param $path
 *
 * @return array
 */
public function getContent(string $path, int $step): array
{
	$result = [
		'DATA' => null,
		'~DATA' => null,
		'FILE_NAME' => null,
		'SANITIZE' => false,
		'COUNT' => 0,
	];

	try
	{
		$content = $this->get($path, $step);
		if (!is_null($content['DATA']))
		{
			$result['~DATA'] = Json::decode($content['DATA']);
			if (!empty($result['~DATA']))
			{
				$result['DATA'] = Helper::getInstance()->sanitize($result['~DATA'], $result['SANITIZE']);
			}
		}
		else
		{
			$result['ERROR_CODE'] = self::ERROR_DATA_NOT_FOUND;
		}

		if ($content['FILE_NAME'])
		{
			$result['FILE_NAME'] = preg_replace(
				'/(' . Helper::CONFIGURATION_FILE_EXTENSION . ')$/i',
				'',
				$content['FILE_NAME']
			);
		}

		if (!empty($content['COUNT']) && (int)$content['COUNT'] > 0)
		{
			$result['COUNT'] = (int)$content['COUNT'];
		}
	}
	catch (ArgumentException $exception)
	{
		$result['ERROR_CODE'] = self::ERROR_DECODE_DATA;
	}
	catch (SystemException $exception)
	{
		$result['ERROR_CODE'] = self::ERROR_DATA_NOT_FOUND;
	}

	return $result;
}