• Модуль: imopenlines
  • Путь к файлу: ~/bitrix/modules/imopenlines/lib/search/mapbuilder.php
  • Класс: BitrixImopenlinesSearchMapBuilder
  • Вызов: MapBuilder::addPhone
public function addPhone($phone)
{
	$phone = (string)$phone;
	$value = preg_replace("/[^0-9#*]/i", "", $phone);
	if($value == '')
		return $this;

	$length = strlen($value);
	if($length >= 10 && substr($value, 0, 1) === '7')
	{
		$altPhone = '8'.substr($value, 1);
		$this->tokens[$altPhone] = true;
	}

	//Right bound. We will stop when 3 digits are left.
	$bound = $length - 2;
	if($bound > 0)
	{
		for($i = 0; $i < $bound; $i++)
		{
			$key = substr($value, $i);
			$this->tokens[$key] = true;
		}
	}

	return $this;
}