• Модуль: ui
  • Путь к файлу: ~/bitrix/modules/ui/lib/barcode/barcodegenerator.php
  • Класс: BitrixUIBarcodeBarcodeGenerator
  • Вызов: BarcodeGenerator::qr_encode_numeric
private function qr_encode_numeric($data, $version_group) {
	$code = array(0, 0, 0, 1);
	$length = strlen($data);
	switch ($version_group) {
		case 2:  /* 27 - 40 */
			$code[] = $length & 0x2000;
			$code[] = $length & 0x1000;
		case 1:  /* 10 - 26 */
			$code[] = $length & 0x0800;
			$code[] = $length & 0x0400;
		case 0:  /* 1 - 9 */
			$code[] = $length & 0x0200;
			$code[] = $length & 0x0100;
			$code[] = $length & 0x0080;
			$code[] = $length & 0x0040;
			$code[] = $length & 0x0020;
			$code[] = $length & 0x0010;
			$code[] = $length & 0x0008;
			$code[] = $length & 0x0004;
			$code[] = $length & 0x0002;
			$code[] = $length & 0x0001;
	}
	for ($i = 0; $i < $length; $i += 3) {
		$group = substr($data, $i, 3);
		switch (strlen($group)) {
			case 3:
				$code[] = $group & 0x200;
				$code[] = $group & 0x100;
				$code[] = $group & 0x080;
			case 2:
				$code[] = $group & 0x040;
				$code[] = $group & 0x020;
				$code[] = $group & 0x010;
			case 1:
				$code[] = $group & 0x008;
				$code[] = $group & 0x004;
				$code[] = $group & 0x002;
				$code[] = $group & 0x001;
		}
	}
	return $code;
}