• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/lib/CustomSection/Entity/CodeGenerator.php
  • Класс: BitrixIntranetCustomSectionEntityCodeGenerator
  • Вызов: CodeGenerator::generateRandomCode
protected function generateRandomCode(int $try = 1): ?string
{
	if ($try >= static::MAX_NUMBER_OF_TRIES)
	{
		return null;
	}

	$code = Random::getStringByAlphabet(static::RANDOM_CODE_LENGTH + $try, Random::ALPHABET_ALPHALOWER);

	if ($this->isCodeShouldBeUnique() && !$this->isCodeUnique($code))
	{
		return $this->generateRandomCode($try + 1);
	}

	return $code;
}