BarcodeGenerator::qr_encode_ec

  1. Bitrix24 API (v. 23.675.0)
  2. ui
  3. BarcodeGenerator
  4. qr_encode_ec
  • Модуль: ui
  • Путь к файлу: ~/bitrix/modules/ui/lib/barcode/barcodegenerator.php
  • Класс: BitrixUIBarcodeBarcodeGenerator
  • Вызов: BarcodeGenerator::qr_encode_ec
private function qr_encode_ec($data, $ec_params, $version) {
	$blocks = $this->qr_ec_split($data, $ec_params);
	$ec_blocks = array();
	for ($i = 0, $n = count($blocks); $i < $n; $i++) {
		$ec_blocks[] = $this->qr_ec_divide($blocks[$i], $ec_params);
	}
	$data = $this->qr_ec_interleave($blocks);
	$ec_data = $this->qr_ec_interleave($ec_blocks);
	$code = array();
	foreach ($data as $ch) {
		$code[] = $ch & 0x80;
		$code[] = $ch & 0x40;
		$code[] = $ch & 0x20;
		$code[] = $ch & 0x10;
		$code[] = $ch & 0x08;
		$code[] = $ch & 0x04;
		$code[] = $ch & 0x02;
		$code[] = $ch & 0x01;
	}
	foreach ($ec_data as $ch) {
		$code[] = $ch & 0x80;
		$code[] = $ch & 0x40;
		$code[] = $ch & 0x20;
		$code[] = $ch & 0x10;
		$code[] = $ch & 0x08;
		$code[] = $ch & 0x04;
		$code[] = $ch & 0x02;
		$code[] = $ch & 0x01;
	}
	for ($n = $this->qr_remainder_bits[$version - 1]; $n > 0; $n--) {
		$code[] = 0;
	}
	return $code;
}

Добавить комментарий