• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/phonenumber/tools/possiblelengthfield.php
  • Класс: BitrixMainPhoneNumberToolsPossibleLengthField
  • Вызов: PossibleLengthField::parsePossibleLength
static function parsePossibleLength($possibleLength)
{
	$result = array();
	$tokens = explode(',', $possibleLength);
	foreach ($tokens as $token)
	{
		if(preg_match('/^d+$/', $token))
		{
			$result[] = (int)$token;
		}
		else if(preg_match('/^[(d+)-(d+)]$/', $token, $matches))
		{
			$start = $matches[1];
			$end = $matches[2];
			$result = array_merge($result, range($start, $end));
		}
		else
		{
			throw new SystemException("Unrecognized token: ", $token);
		}
	}
	return $result;
}