• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/lib/automation/engine/templatescope.php
  • Класс: BitrixBizprocAutomationEngineTemplateScope
  • Вызов: TemplateScope::fromArray
static function fromArray(array $rawScope): ?TemplateScope
{
	if (
		is_array($rawScope['DocumentType'] ?? null)
		&& is_array($rawScope['Category'] ?? null)
		&& is_array($rawScope['Status'] ?? null)
	)
	{
		$scope = new static(
			$rawScope['DocumentType']['Type'] ?? [],
			$rawScope['Category']['Id'] ?? null,
			$rawScope['Status']['Id'] ?? '',
		);
		$scope->setNames(
			$rawScope['Category']['Name'] ?? null,
			$rawScope['Status']['Name'] ?? null
		);

		if (isset($rawScope['Status']['Color']) && is_string($rawScope['Status']['Color']))
		{
			$scope->setStatusColor($rawScope['Status']['Color']);
		}

		return $scope;
	}

	return null;
}