• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/ml/scoring.php
  • Класс: Bitrix\Crm\Ml\Scoring
  • Вызов: Scoring::getModelByName
static function getModelByName($modelName)
{
	static $cache = [];

	if (isset($cache[$modelName]))
	{
		return $cache[$modelName];
	}

	$possibleModels = [Model\LeadScoring::class, Model\DealScoring::class];

	foreach ($possibleModels as $model)
	{
		$possibleNames = $model::getModelNames();

		if (in_array($modelName, $possibleNames, true))
		{
			$cache[$modelName] = new $model($modelName);

			return $cache[$modelName];
		}
	}

	return null;
}