This commit is contained in:
wangjinlei
2022-03-30 11:59:42 +08:00
parent 22aa65547b
commit 6313a35360
102 changed files with 3278 additions and 15906 deletions

View File

@@ -229,7 +229,7 @@ class Datamatrix {
/**
* This is the class constructor.
* Creates a datamatrix object
* @param $code (string) Code to represent using Datamatrix.
* @param string $code Code to represent using Datamatrix.
* @public
*/
public function __construct($code) {
@@ -355,11 +355,11 @@ class Datamatrix {
/**
* Product of two numbers in a Power-of-Two Galois Field
* @param $a (int) first number to multiply.
* @param $b (int) second number to multiply.
* @param $log (array) Log table.
* @param $alog (array) Anti-Log table.
* @param $gf (array) Number of Factors of the Reed-Solomon polynomial.
* @param int $a first number to multiply.
* @param int $b second number to multiply.
* @param array $log Log table.
* @param array $alog Anti-Log table.
* @param int $gf Number of Factors of the Reed-Solomon polynomial.
* @return int product
* @protected
*/
@@ -372,12 +372,12 @@ class Datamatrix {
/**
* Add error correction codewords to data codewords array (ANNEX E).
* @param $wd (array) Array of datacodewords.
* @param $nb (int) Number of blocks.
* @param $nd (int) Number of data codewords per block.
* @param $nc (int) Number of correction codewords per block.
* @param $gf (int) numner of fields on log/antilog table (power of 2).
* @param $pp (int) The value of its prime modulus polynomial (301 for ECC200).
* @param array $wd Array of datacodewords.
* @param int $nb Number of blocks.
* @param int $nd Number of data codewords per block.
* @param int $nc Number of correction codewords per block.
* @param int $gf numner of fields on log/antilog table (power of 2).
* @param int $pp The value of its prime modulus polynomial (301 for ECC200).
* @return array data codewords + error codewords
* @protected
*/
@@ -438,9 +438,9 @@ class Datamatrix {
/**
* Return the 253-state codeword
* @param $cwpad (int) Pad codeword.
* @param $cwpos (int) Number of data codewords from the beginning of encoded data.
* @return pad codeword
* @param int $cwpad Pad codeword.
* @param int $cwpos Number of data codewords from the beginning of encoded data.
* @return int pad codeword
* @protected
*/
protected function get253StateCodeword($cwpad, $cwpos) {
@@ -453,9 +453,9 @@ class Datamatrix {
/**
* Return the 255-state codeword
* @param $cwpad (int) Pad codeword.
* @param $cwpos (int) Number of data codewords from the beginning of encoded data.
* @return pad codeword
* @param int $cwpad Pad codeword.
* @param int $cwpos Number of data codewords from the beginning of encoded data.
* @return int pad codeword
* @protected
*/
protected function get255StateCodeword($cwpad, $cwpos) {
@@ -468,8 +468,8 @@ class Datamatrix {
/**
* Returns true if the char belongs to the selected mode
* @param $chr (int) Character (byte) to check.
* @param $mode (int) Current encoding mode.
* @param int $chr Character (byte) to check.
* @param int $mode Current encoding mode.
* @return boolean true if the char is of the selected mode.
* @protected
*/
@@ -514,9 +514,9 @@ class Datamatrix {
/**
* The look-ahead test scans the data to be encoded to find the best mode (Annex P - steps from J to S).
* @param $data (string) data to encode
* @param $pos (int) current position
* @param $mode (int) current encoding mode
* @param string $data data to encode
* @param int $pos current position
* @param int $mode current encoding mode
* @return int encoding mode
* @protected
*/
@@ -646,8 +646,8 @@ class Datamatrix {
/**
* Get the switching codeword to a new encoding mode (latch codeword)
* @param $mode (int) New encoding mode.
* @return (int) Switch codeword.
* @param int $mode New encoding mode.
* @return int Switch codeword.
* @protected
*/
protected function getSwitchEncodingCodeword($mode) {
@@ -685,8 +685,8 @@ class Datamatrix {
/**
* Choose the minimum matrix size and return the max number of data codewords.
* @param $numcw (int) Number of current codewords.
* @return number of data codewords in matrix
* @param int $numcw Number of current codewords.
* @return int number of data codewords in matrix
* @protected
*/
protected function getMaxDataCodewords($numcw) {
@@ -700,7 +700,7 @@ class Datamatrix {
/**
* Get high level encoding using the minimum symbol data characters for ECC 200
* @param $data (string) data to encode
* @param string $data data to encode
* @return array of codewords
* @protected
*/
@@ -970,13 +970,13 @@ class Datamatrix {
/**
* Places "chr+bit" with appropriate wrapping within array[].
* (Annex F - ECC 200 symbol character placement)
* @param $marr (array) Array of symbols.
* @param $nrow (int) Number of rows.
* @param $ncol (int) Number of columns.
* @param $row (int) Row number.
* @param $col (int) Column number.
* @param $chr (int) Char byte.
* @param $bit (int) Bit.
* @param array $marr Array of symbols.
* @param int $nrow Number of rows.
* @param int $ncol Number of columns.
* @param int $row Row number.
* @param int $col Column number.
* @param int $chr Char byte.
* @param int $bit Bit.
* @return array
* @protected
*/
@@ -996,12 +996,12 @@ class Datamatrix {
/**
* Places the 8 bits of a utah-shaped symbol character.
* (Annex F - ECC 200 symbol character placement)
* @param $marr (array) Array of symbols.
* @param $nrow (int) Number of rows.
* @param $ncol (int) Number of columns.
* @param $row (int) Row number.
* @param $col (int) Column number.
* @param $chr (int) Char byte.
* @param array $marr Array of symbols.
* @param int $nrow Number of rows.
* @param int $ncol Number of columns.
* @param int $row Row number.
* @param int $col Column number.
* @param int $chr Char byte.
* @return array
* @protected
*/
@@ -1020,10 +1020,10 @@ class Datamatrix {
/**
* Places the 8 bits of the first special corner case.
* (Annex F - ECC 200 symbol character placement)
* @param $marr (array) Array of symbols.
* @param $nrow (int) Number of rows.
* @param $ncol (int) Number of columns.
* @param $chr (int) Char byte.
* @param array $marr Array of symbols.
* @param int $nrow Number of rows.
* @param int $ncol Number of columns.
* @param int $chr Char byte.
* @return array
* @protected
*/
@@ -1042,10 +1042,10 @@ class Datamatrix {
/**
* Places the 8 bits of the second special corner case.
* (Annex F - ECC 200 symbol character placement)
* @param $marr (array) Array of symbols.
* @param $nrow (int) Number of rows.
* @param $ncol (int) Number of columns.
* @param $chr (int) Char byte.
* @param array $marr Array of symbols.
* @param int $nrow Number of rows.
* @param int $ncol Number of columns.
* @param int $chr Char byte.
* @return array
* @protected
*/
@@ -1064,10 +1064,10 @@ class Datamatrix {
/**
* Places the 8 bits of the third special corner case.
* (Annex F - ECC 200 symbol character placement)
* @param $marr (array) Array of symbols.
* @param $nrow (int) Number of rows.
* @param $ncol (int) Number of columns.
* @param $chr (int) Char byte.
* @param array $marr Array of symbols.
* @param int $nrow Number of rows.
* @param int $ncol Number of columns.
* @param int $chr Char byte.
* @return array
* @protected
*/
@@ -1086,10 +1086,10 @@ class Datamatrix {
/**
* Places the 8 bits of the fourth special corner case.
* (Annex F - ECC 200 symbol character placement)
* @param $marr (array) Array of symbols.
* @param $nrow (int) Number of rows.
* @param $ncol (int) Number of columns.
* @param $chr (int) Char byte.
* @param array $marr Array of symbols.
* @param int $nrow Number of rows.
* @param int $ncol Number of columns.
* @param int $chr Char byte.
* @return array
* @protected
*/
@@ -1108,8 +1108,8 @@ class Datamatrix {
/**
* Build a placement map.
* (Annex F - ECC 200 symbol character placement)
* @param $nrow (int) Number of rows.
* @param $ncol (int) Number of columns.
* @param int $nrow Number of rows.
* @param int $ncol Number of columns.
* @return array
* @protected
*/

View File

@@ -523,10 +523,10 @@ class PDF417 {
/**
* This is the class constructor.
* Creates a PDF417 object
* @param $code (string) code to represent using PDF417
* @param $ecl (int) error correction level (0-8); default -1 = automatic correction level
* @param $aspectratio (float) the width to height of the symbol (excluding quiet zones)
* @param $macro (array) information for macro block
* @param string $code code to represent using PDF417
* @param int $ecl error correction level (0-8); default -1 = automatic correction level
* @param float $aspectratio the width to height of the symbol (excluding quiet zones)
* @param array $macro information for macro block
* @public
*/
public function __construct($code, $ecl=-1, $aspectratio=2, $macro=array()) {
@@ -734,12 +734,13 @@ class PDF417 {
/**
* Returns the error correction level (0-8) to be used
* @param $ecl (int) error correction level
* @param $numcw (int) number of data codewords
* @param int $ecl error correction level
* @param int $numcw number of data codewords
* @return int error correction level
* @protected
*/
protected function getErrorCorrectionLevel($ecl, $numcw) {
$maxecl = 8; // starting error level
// check for automatic levels
if (($ecl < 0) OR ($ecl > 8)) {
if ($numcw < 41) {
@@ -755,7 +756,6 @@ class PDF417 {
}
}
// get maximum correction level
$maxecl = 8; // starting error level
$maxerrsize = (928 - $numcw); // available codewords for error
while ($maxecl > 0) {
$errsize = (2 << $ecl);
@@ -772,8 +772,8 @@ class PDF417 {
/**
* Returns the error correction codewords
* @param $cw (array) array of codewords including Symbol Length Descriptor and pad
* @param $ecl (int) error correction level 0-8
* @param array $cw array of codewords including Symbol Length Descriptor and pad
* @param int $ecl error correction level 0-8
* @return array of error correction codewords
* @protected
*/
@@ -809,8 +809,8 @@ class PDF417 {
/**
* Create array of sequences from input
* @param $code (string) code
* @return bidimensional array containing characters and classification
* @param string $code code
* @return array bi-dimensional array containing characters and classification
* @protected
*/
protected function getInputSequences($code) {
@@ -864,9 +864,9 @@ class PDF417 {
/**
* Compact data by mode.
* @param $mode (int) compaction mode number
* @param $code (string) data to compact
* @param $addmode (boolean) if true add the mode codeword at first position
* @param int $mode compaction mode number
* @param string $code data to compact
* @param boolean $addmode if true add the mode codeword at first position
* @return array of codewords
* @protected
*/

View File

@@ -247,32 +247,6 @@ if (!defined('QRCODEDEFS')) {
} // end of definitions
// #*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
// for compatibility with PHP4
if (!function_exists('str_split')) {
/**
* Convert a string to an array (needed for PHP4 compatibility)
* @param $string (string) The input string.
* @param $split_length (int) Maximum length of the chunk.
* @return If the optional split_length parameter is specified, the returned array will be broken down into chunks with each being split_length in length, otherwise each chunk will be one character in length. FALSE is returned if split_length is less than 1. If the split_length length exceeds the length of string , the entire string is returned as the first (and only) array element.
*/
function str_split($string, $split_length=1) {
if ((strlen($string) > $split_length) OR (!$split_length)) {
do {
$c = strlen($string);
$parts[] = substr($string, 0, $split_length);
$string = substr($string, $split_length);
} while ($string !== false);
} else {
$parts = array($string);
}
return $parts;
}
}
// #####################################################
/**
* @class QRcode
* Class to create QR-code arrays for TCPDF class.
@@ -631,8 +605,8 @@ class QRcode {
/**
* This is the class constructor.
* Creates a QRcode object
* @param $code (string) code to represent using QRcode
* @param $eclevel (string) error level: <ul><li>L : About 7% or less errors can be corrected.</li><li>M : About 15% or less errors can be corrected.</li><li>Q : About 25% or less errors can be corrected.</li><li>H : About 30% or less errors can be corrected.</li></ul>
* @param string $code code to represent using QRcode
* @param string $eclevel error level: <ul><li>L : About 7% or less errors can be corrected.</li><li>M : About 15% or less errors can be corrected.</li><li>Q : About 25% or less errors can be corrected.</li><li>H : About 30% or less errors can be corrected.</li></ul>
* @public
* @since 1.0.000
*/
@@ -683,7 +657,7 @@ class QRcode {
/**
* Convert the frame in binary form
* @param $frame (array) array to binarize
* @param array $frame array to binarize
* @return array frame in binary form
*/
protected function binarize($frame) {
@@ -699,7 +673,7 @@ class QRcode {
/**
* Encode the input string to QR code
* @param $string (string) input string to encode
* @param string $string input string to encode
*/
protected function encodeString($string) {
$this->dataStr = $string;
@@ -715,7 +689,7 @@ class QRcode {
/**
* Encode mask
* @param $mask (int) masking mode
* @param int $mask masking mode
*/
protected function encodeMask($mask) {
$spec = array(0, 0, 0, 0, 0);
@@ -780,8 +754,8 @@ class QRcode {
/**
* Set frame value at specified position
* @param $at (array) x,y position
* @param $val (int) value of the character to set
* @param array $at x,y position
* @param int $val value of the character to set
*/
protected function setFrameAt($at, $val) {
$this->frame[$at['y']][$at['x']] = chr($val);
@@ -789,7 +763,7 @@ class QRcode {
/**
* Get frame value at specified position
* @param $at (array) x,y position
* @param array $at x,y position
* @return value at specified position
*/
protected function getFrameAt($at) {
@@ -853,8 +827,8 @@ class QRcode {
/**
* Initialize code.
* @param $spec (array) array of ECC specification
* @return 0 in case of success, -1 in case of error
* @param array $spec array of ECC specification
* @return int 0 in case of success, -1 in case of error
*/
protected function init($spec) {
$dl = $this->rsDataCodes1($spec);
@@ -932,10 +906,10 @@ class QRcode {
/**
* Write Format Information on frame and returns the number of black bits
* @param $width (int) frame width
* @param $frame (array) frame
* @param $mask (array) masking mode
* @param $level (int) error correction level
* @param int $width frame width
* @param array $frame frame
* @param array $mask masking mode
* @param int $level error correction level
* @return int blacks
*/
protected function writeFormatInformation($width, &$frame, $mask, $level) {
@@ -976,8 +950,8 @@ class QRcode {
/**
* mask0
* @param $x (int) X position
* @param $y (int) Y position
* @param int $x X position
* @param int $y Y position
* @return int mask
*/
protected function mask0($x, $y) {
@@ -986,8 +960,8 @@ class QRcode {
/**
* mask1
* @param $x (int) X position
* @param $y (int) Y position
* @param int $x X position
* @param int $y Y position
* @return int mask
*/
protected function mask1($x, $y) {
@@ -996,8 +970,8 @@ class QRcode {
/**
* mask2
* @param $x (int) X position
* @param $y (int) Y position
* @param int $x X position
* @param int $y Y position
* @return int mask
*/
protected function mask2($x, $y) {
@@ -1006,8 +980,8 @@ class QRcode {
/**
* mask3
* @param $x (int) X position
* @param $y (int) Y position
* @param int $x X position
* @param int $y Y position
* @return int mask
*/
protected function mask3($x, $y) {
@@ -1016,8 +990,8 @@ class QRcode {
/**
* mask4
* @param $x (int) X position
* @param $y (int) Y position
* @param int $x X position
* @param int $y Y position
* @return int mask
*/
protected function mask4($x, $y) {
@@ -1026,8 +1000,8 @@ class QRcode {
/**
* mask5
* @param $x (int) X position
* @param $y (int) Y position
* @param int $x X position
* @param int $y Y position
* @return int mask
*/
protected function mask5($x, $y) {
@@ -1036,8 +1010,8 @@ class QRcode {
/**
* mask6
* @param $x (int) X position
* @param $y (int) Y position
* @param int $x X position
* @param int $y Y position
* @return int mask
*/
protected function mask6($x, $y) {
@@ -1046,8 +1020,8 @@ class QRcode {
/**
* mask7
* @param $x (int) X position
* @param $y (int) Y position
* @param int $x X position
* @param int $y Y position
* @return int mask
*/
protected function mask7($x, $y) {
@@ -1056,9 +1030,9 @@ class QRcode {
/**
* Return bitmask
* @param $maskNo (int) mask number
* @param $width (int) width
* @param $frame (array) frame
* @param int $maskNo mask number
* @param int $width width
* @param array $frame frame
* @return array bitmask
*/
protected function generateMaskNo($maskNo, $width, $frame) {
@@ -1078,11 +1052,11 @@ class QRcode {
/**
* makeMaskNo
* @param $maskNo (int)
* @param $width (int)
* @param $s (int)
* @param $d (int)
* @param $maskGenOnly (boolean)
* @param int $maskNo
* @param int $width
* @param int $s
* @param int $d
* @param boolean $maskGenOnly
* @return int b
*/
protected function makeMaskNo($maskNo, $width, $s, &$d, $maskGenOnly=false) {
@@ -1106,10 +1080,10 @@ class QRcode {
/**
* makeMask
* @param $width (int)
* @param $frame (array)
* @param $maskNo (int)
* @param $level (int)
* @param int $width
* @param array $frame
* @param int $maskNo
* @param int $level
* @return array mask
*/
protected function makeMask($width, $frame, $maskNo, $level) {
@@ -1121,7 +1095,7 @@ class QRcode {
/**
* calcN1N3
* @param $length (int)
* @param int $length
* @return int demerit
*/
protected function calcN1N3($length) {
@@ -1151,8 +1125,8 @@ class QRcode {
/**
* evaluateSymbol
* @param $width (int)
* @param $frame (array)
* @param int $width
* @param array $frame
* @return int demerit
*/
protected function evaluateSymbol($width, $frame) {
@@ -1212,9 +1186,9 @@ class QRcode {
/**
* mask
* @param $width (int)
* @param $frame (array)
* @param $level (int)
* @param int $width
* @param array $frame
* @param int $level
* @return array best mask
*/
protected function mask($width, $frame, $level) {
@@ -1255,8 +1229,8 @@ class QRcode {
/**
* Return true if the character at specified position is a number
* @param $str (string) string
* @param $pos (int) characted position
* @param string $str string
* @param int $pos characted position
* @return boolean true of false
*/
protected function isdigitat($str, $pos) {
@@ -1268,8 +1242,8 @@ class QRcode {
/**
* Return true if the character at specified position is an alphanumeric character
* @param $str (string) string
* @param $pos (int) characted position
* @param string $str string
* @param int $pos characted position
* @return boolean true of false
*/
protected function isalnumat($str, $pos) {
@@ -1281,7 +1255,7 @@ class QRcode {
/**
* identifyMode
* @param $pos (int)
* @param int $pos
* @return int mode
*/
protected function identifyMode($pos) {
@@ -1386,6 +1360,7 @@ class QRcode {
$p += 2;
}
$this->items = $this->appendNewInputItem($this->items, QR_MODE_KJ, $p, str_split($this->dataStr));
$run = $p;
return $run;
}
@@ -1440,7 +1415,7 @@ class QRcode {
/**
* splitString
* @return (int)
* @return int
*/
protected function splitString() {
while (strlen($this->dataStr) > 0) {
@@ -1455,7 +1430,7 @@ class QRcode {
break;
}
case QR_MODE_KJ: {
if ($hint == QR_MODE_KJ) {
if ($this->hint == QR_MODE_KJ) {
$length = $this->eatKanji();
} else {
$length = $this->eat8();
@@ -1504,10 +1479,10 @@ class QRcode {
/**
* newInputItem
* @param $mode (int)
* @param $size (int)
* @param $data (array)
* @param $bstream (array)
* @param int $mode
* @param int $size
* @param array $data
* @param array $bstream
* @return array input item
*/
protected function newInputItem($mode, $size, $data, $bstream=null) {
@@ -1528,8 +1503,8 @@ class QRcode {
/**
* encodeModeNum
* @param $inputitem (array)
* @param $version (int)
* @param array $inputitem
* @param int $version
* @return array input item
*/
protected function encodeModeNum($inputitem, $version) {
@@ -1557,8 +1532,8 @@ class QRcode {
/**
* encodeModeAn
* @param $inputitem (array)
* @param $version (int)
* @param array $inputitem
* @param int $version
* @return array input item
*/
protected function encodeModeAn($inputitem, $version) {
@@ -1580,8 +1555,8 @@ class QRcode {
/**
* encodeMode8
* @param $inputitem (array)
* @param $version (int)
* @param array $inputitem
* @param int $version
* @return array input item
*/
protected function encodeMode8($inputitem, $version) {
@@ -1596,8 +1571,8 @@ class QRcode {
/**
* encodeModeKanji
* @param $inputitem (array)
* @param $version (int)
* @param array $inputitem
* @param int $version
* @return array input item
*/
protected function encodeModeKanji($inputitem, $version) {
@@ -1620,7 +1595,7 @@ class QRcode {
/**
* encodeModeStructure
* @param $inputitem (array)
* @param array $inputitem
* @return array input item
*/
protected function encodeModeStructure($inputitem) {
@@ -1634,8 +1609,8 @@ class QRcode {
/**
* encodeBitStream
* @param $inputitem (array)
* @param $version (int)
* @param array $inputitem
* @param int $version
* @return array input item
*/
protected function encodeBitStream($inputitem, $version) {
@@ -1686,11 +1661,11 @@ class QRcode {
/**
* Append data to an input object.
* The data is copied and appended to the input object.
* @param $items (arrray) input items
* @param $mode (int) encoding mode.
* @param $size (int) size of data (byte).
* @param $data (array) array of input data.
* @return items
* @param array $items input items
* @param int $mode encoding mode.
* @param int $size size of data (byte).
* @param array $data array of input data.
* @return array items
*
*/
protected function appendNewInputItem($items, $mode, $size, $data) {
@@ -1703,10 +1678,10 @@ class QRcode {
/**
* insertStructuredAppendHeader
* @param $items (array)
* @param $size (int)
* @param $index (int)
* @param $parity (int)
* @param array $items
* @param int $size
* @param int $index
* @param int $parity
* @return array items
*/
protected function insertStructuredAppendHeader($items, $size, $index, $parity) {
@@ -1724,7 +1699,7 @@ class QRcode {
/**
* calcParity
* @param $items (array)
* @param array $items
* @return int parity
*/
protected function calcParity($items) {
@@ -1741,8 +1716,8 @@ class QRcode {
/**
* checkModeNum
* @param $size (int)
* @param $data (array)
* @param int $size
* @param array $data
* @return boolean true or false
*/
protected function checkModeNum($size, $data) {
@@ -1755,9 +1730,9 @@ class QRcode {
}
/**
* Look up the alphabet-numeric convesion table (see JIS X0510:2004, pp.19).
* @param $c (int) character value
* @return value
* Look up the alphabet-numeric conversion table (see JIS X0510:2004, pp.19).
* @param int $c character value
* @return int value
*/
protected function lookAnTable($c) {
return (($c > 127)?-1:$this->anTable[$c]);
@@ -1765,8 +1740,8 @@ class QRcode {
/**
* checkModeAn
* @param $size (int)
* @param $data (array)
* @param int $size
* @param array $data
* @return boolean true or false
*/
protected function checkModeAn($size, $data) {
@@ -1780,7 +1755,7 @@ class QRcode {
/**
* estimateBitsModeNum
* @param $size (int)
* @param int $size
* @return int number of bits
*/
protected function estimateBitsModeNum($size) {
@@ -1801,7 +1776,7 @@ class QRcode {
/**
* estimateBitsModeAn
* @param $size (int)
* @param int $size
* @return int number of bits
*/
protected function estimateBitsModeAn($size) {
@@ -1814,7 +1789,7 @@ class QRcode {
/**
* estimateBitsMode8
* @param $size (int)
* @param int $size
* @return int number of bits
*/
protected function estimateBitsMode8($size) {
@@ -1823,7 +1798,7 @@ class QRcode {
/**
* estimateBitsModeKanji
* @param $size (int)
* @param int $size
* @return int number of bits
*/
protected function estimateBitsModeKanji($size) {
@@ -1832,8 +1807,8 @@ class QRcode {
/**
* checkModeKanji
* @param $size (int)
* @param $data (array)
* @param int $size
* @param array $data
* @return boolean true or false
*/
protected function checkModeKanji($size, $data) {
@@ -1851,9 +1826,9 @@ class QRcode {
/**
* Validate the input data.
* @param $mode (int) encoding mode.
* @param $size (int) size of data (byte).
* @param $data (array) data to validate
* @param int $mode encoding mode.
* @param int $size size of data (byte).
* @param array $data data to validate
* @return boolean true in case of valid data, false otherwise
*/
protected function check($mode, $size, $data) {
@@ -1885,8 +1860,8 @@ class QRcode {
/**
* estimateBitStreamSize
* @param $items (array)
* @param $version (int)
* @param array $items
* @param int $version
* @return int bits
*/
protected function estimateBitStreamSize($items, $version) {
@@ -1929,7 +1904,7 @@ class QRcode {
/**
* estimateVersion
* @param $items (array)
* @param array $items
* @return int version
*/
protected function estimateVersion($items) {
@@ -1948,9 +1923,9 @@ class QRcode {
/**
* lengthOfCode
* @param $mode (int)
* @param $version (int)
* @param $bits (int)
* @param int $mode
* @param int $version
* @param int $bits
* @return int size
*/
protected function lengthOfCode($mode, $version, $bits) {
@@ -2005,7 +1980,7 @@ class QRcode {
/**
* createBitStream
* @param $items (array)
* @param array $items
* @return array of items and total bits
*/
protected function createBitStream($items) {
@@ -2020,7 +1995,7 @@ class QRcode {
/**
* convertData
* @param $items (array)
* @param array $items
* @return array items
*/
protected function convertData($items) {
@@ -2049,7 +2024,7 @@ class QRcode {
/**
* Append Padding Bit to bitstream
* @param $bstream (array)
* @param array $bstream
* @return array bitstream
*/
protected function appendPaddingBit($bstream) {
@@ -2082,7 +2057,7 @@ class QRcode {
/**
* mergeBitStream
* @param $items (array) items
* @param array $items items
* @return array bitstream
*/
protected function mergeBitStream($items) {
@@ -2099,7 +2074,7 @@ class QRcode {
/**
* Returns a stream of bits.
* @param $items (int)
* @param int $items
* @return array padded merged byte stream
*/
protected function getBitStream($items) {
@@ -2109,7 +2084,7 @@ class QRcode {
/**
* Pack all bit streams padding bits into a byte array.
* @param $items (int)
* @param int $items
* @return array padded merged byte stream
*/
protected function getByteStream($items) {
@@ -2123,7 +2098,7 @@ class QRcode {
/**
* Return an array with zeros
* @param $setLength (int) array size
* @param int $setLength array size
* @return array
*/
protected function allocate($setLength) {
@@ -2132,8 +2107,8 @@ class QRcode {
/**
* Return new bitstream from number
* @param $bits (int) number of bits
* @param $num (int) number
* @param int $bits number of bits
* @param int $num number
* @return array bitstream
*/
protected function newFromNum($bits, $num) {
@@ -2152,8 +2127,8 @@ class QRcode {
/**
* Return new bitstream from bytes
* @param $size (int) size
* @param $data (array) bytes
* @param int $size size
* @param array $data bytes
* @return array bitstream
*/
protected function newFromBytes($size, $data) {
@@ -2176,8 +2151,8 @@ class QRcode {
/**
* Append one bitstream to another
* @param $bitstream (array) original bitstream
* @param $append (array) bitstream to append
* @param array $bitstream original bitstream
* @param array $append bitstream to append
* @return array bitstream
*/
protected function appendBitstream($bitstream, $append) {
@@ -2192,9 +2167,9 @@ class QRcode {
/**
* Append one bitstream created from number to another
* @param $bitstream (array) original bitstream
* @param $bits (int) number of bits
* @param $num (int) number
* @param array $bitstream original bitstream
* @param int $bits number of bits
* @param int $num number
* @return array bitstream
*/
protected function appendNum($bitstream, $bits, $num) {
@@ -2207,9 +2182,9 @@ class QRcode {
/**
* Append one bitstream created from bytes to another
* @param $bitstream (array) original bitstream
* @param $size (int) size
* @param $data (array) bytes
* @param array $bitstream original bitstream
* @param int $size size
* @param array $data bytes
* @return array bitstream
*/
protected function appendBytes($bitstream, $size, $data) {
@@ -2222,7 +2197,7 @@ class QRcode {
/**
* Convert bitstream to bytes
* @param $bstream (array) original bitstream
* @param array $bstream original bitstream
* @return array of bytes
*/
protected function bitstreamToByte($bstream) {
@@ -2263,11 +2238,11 @@ class QRcode {
/**
* Replace a value on the array at the specified position
* @param $srctab (array)
* @param $x (int) X position
* @param $y (int) Y position
* @param $repl (string) value to replace
* @param $replLen (int) length of the repl string
* @param array $srctab
* @param int $x X position
* @param int $y Y position
* @param string $repl value to replace
* @param int $replLen length of the repl string
* @return array srctab
*/
protected function qrstrset($srctab, $x, $y, $repl, $replLen=false) {
@@ -2277,8 +2252,8 @@ class QRcode {
/**
* Return maximum data code length (bytes) for the version.
* @param $version (int) version
* @param $level (int) error correction level
* @param int $version version
* @param int $level error correction level
* @return int maximum size (bytes)
*/
protected function getDataLength($version, $level) {
@@ -2287,8 +2262,8 @@ class QRcode {
/**
* Return maximum error correction code length (bytes) for the version.
* @param $version (int) version
* @param $level (int) error correction level
* @param int $version version
* @param int $level error correction level
* @return int ECC size (bytes)
*/
protected function getECCLength($version, $level){
@@ -2297,7 +2272,7 @@ class QRcode {
/**
* Return the width of the symbol for the version.
* @param $version (int) version
* @param int $version version
* @return int width
*/
protected function getWidth($version) {
@@ -2306,7 +2281,7 @@ class QRcode {
/**
* Return the numer of remainder bits.
* @param $version (int) version
* @param int $version version
* @return int number of remainder bits
*/
protected function getRemainder($version) {
@@ -2315,8 +2290,8 @@ class QRcode {
/**
* Return a version number that satisfies the input code length.
* @param $size (int) input code length (bytes)
* @param $level (int) error correction level
* @param int $size input code length (bytes)
* @param int $level error correction level
* @return int version number
*/
protected function getMinimumVersion($size, $level) {
@@ -2332,8 +2307,8 @@ class QRcode {
/**
* Return the size of length indicator for the mode and version.
* @param $mode (int) encoding mode
* @param $version (int) version
* @param int $mode encoding mode
* @param int $version version
* @return int the size of the appropriate length indicator (bits).
*/
protected function lengthIndicator($mode, $version) {
@@ -2352,8 +2327,8 @@ class QRcode {
/**
* Return the maximum length for the mode and version.
* @param $mode (int) encoding mode
* @param $version (int) version
* @param int $mode encoding mode
* @param int $version version
* @return int the maximum length (bytes)
*/
protected function maximumWords($mode, $version) {
@@ -2377,9 +2352,9 @@ class QRcode {
/**
* Return an array of ECC specification.
* @param $version (int) version
* @param $level (int) error correction level
* @param $spec (array) an array of ECC specification contains as following: {# of type1 blocks, # of data code, # of ecc code, # of type2 blocks, # of data code}
* @param int $version version
* @param int $level error correction level
* @param array $spec an array of ECC specification contains as following: {# of type1 blocks, # of data code, # of ecc code, # of type2 blocks, # of data code}
* @return array spec
*/
protected function getEccSpec($version, $level, $spec) {
@@ -2408,9 +2383,9 @@ class QRcode {
/**
* Put an alignment marker.
* @param $frame (array) frame
* @param $ox (int) X center coordinate of the pattern
* @param $oy (int) Y center coordinate of the pattern
* @param array $frame frame
* @param int $ox X center coordinate of the pattern
* @param int $oy Y center coordinate of the pattern
* @return array frame
*/
protected function putAlignmentMarker($frame, $ox, $oy) {
@@ -2431,9 +2406,9 @@ class QRcode {
/**
* Put an alignment pattern.
* @param $version (int) version
* @param $frame (array) frame
* @param $width (int) width
* @param int $version version
* @param array $frame frame
* @param int $width width
* @return array frame
*/
protected function putAlignmentPattern($version, $frame, $width) {
@@ -2473,8 +2448,8 @@ class QRcode {
/**
* Return BCH encoded version information pattern that is used for the symbol of version 7 or greater. Use lower 18 bits.
* @param $version (int) version
* @return BCH encoded version information pattern
* @param int $version version
* @return string BCH encoded version information pattern
*/
protected function getVersionPattern($version) {
if (($version < 7) OR ($version > QRSPEC_VERSION_MAX)) {
@@ -2485,9 +2460,9 @@ class QRcode {
/**
* Return BCH encoded format information pattern.
* @param $mask (array)
* @param $level (int) error correction level
* @return BCH encoded format information pattern
* @param array $mask
* @param int $level error correction level
* @return string BCH encoded format information pattern
*/
protected function getFormatInfo($mask, $level) {
if (($mask < 0) OR ($mask > 7)) {
@@ -2501,9 +2476,9 @@ class QRcode {
/**
* Put a finder pattern.
* @param $frame (array) frame
* @param $ox (int) X center coordinate of the pattern
* @param $oy (int) Y center coordinate of the pattern
* @param array $frame frame
* @param int $ox X center coordinate of the pattern
* @param int $oy Y center coordinate of the pattern
* @return array frame
*/
protected function putFinderPattern($frame, $ox, $oy) {
@@ -2524,8 +2499,8 @@ class QRcode {
/**
* Return a copy of initialized frame.
* @param $version (int) version
* @return Array of unsigned char.
* @param int $version version
* @return array array of unsigned char.
*/
protected function createFrame($version) {
$width = $this->capacity[$version][QRCAP_WIDTH];
@@ -2589,8 +2564,8 @@ class QRcode {
/**
* Set new frame for the specified version.
* @param $version (int) version
* @return Array of unsigned char.
* @param int $version version
* @return array array of unsigned char.
*/
protected function newFrame($version) {
if (($version < 1) OR ($version > QRSPEC_VERSION_MAX)) {
@@ -2607,7 +2582,7 @@ class QRcode {
/**
* Return block number 0
* @param $spec (array)
* @param array $spec
* @return int value
*/
protected function rsBlockNum($spec) {
@@ -2616,7 +2591,7 @@ class QRcode {
/**
* Return block number 1
* @param $spec (array)
* @param array $spec
* @return int value
*/
protected function rsBlockNum1($spec) {
@@ -2625,7 +2600,7 @@ class QRcode {
/**
* Return data codes 1
* @param $spec (array)
* @param array $spec
* @return int value
*/
protected function rsDataCodes1($spec) {
@@ -2634,7 +2609,7 @@ class QRcode {
/**
* Return ecc codes 1
* @param $spec (array)
* @param array $spec
* @return int value
*/
protected function rsEccCodes1($spec) {
@@ -2643,7 +2618,7 @@ class QRcode {
/**
* Return block number 2
* @param $spec (array)
* @param array $spec
* @return int value
*/
protected function rsBlockNum2($spec) {
@@ -2652,7 +2627,7 @@ class QRcode {
/**
* Return data codes 2
* @param $spec (array)
* @param array $spec
* @return int value
*/
protected function rsDataCodes2($spec) {
@@ -2661,7 +2636,7 @@ class QRcode {
/**
* Return ecc codes 2
* @param $spec (array)
* @param array $spec
* @return int value
*/
protected function rsEccCodes2($spec) {
@@ -2670,7 +2645,7 @@ class QRcode {
/**
* Return data length
* @param $spec (array)
* @param array $spec
* @return int value
*/
protected function rsDataLength($spec) {
@@ -2679,7 +2654,7 @@ class QRcode {
/**
* Return ecc length
* @param $spec (array)
* @param array $spec
* @return int value
*/
protected function rsEccLength($spec) {
@@ -2692,12 +2667,12 @@ class QRcode {
/**
* Initialize a Reed-Solomon codec and add it to existing rsitems
* @param $symsize (int) symbol size, bits
* @param $gfpoly (int) Field generator polynomial coefficients
* @param $fcr (int) first root of RS code generator polynomial, index form
* @param $prim (int) primitive element to generate polynomial roots
* @param $nroots (int) RS code generator polynomial degree (number of roots)
* @param $pad (int) padding bytes at front of shortened block
* @param int $symsize symbol size, bits
* @param int $gfpoly Field generator polynomial coefficients
* @param int $fcr first root of RS code generator polynomial, index form
* @param int $prim primitive element to generate polynomial roots
* @param int $nroots RS code generator polynomial degree (number of roots)
* @param int $pad padding bytes at front of shortened block
* @return array Array of RS values:<ul><li>mm = Bits per symbol;</li><li>nn = Symbols per block;</li><li>alpha_to = log lookup table array;</li><li>index_of = Antilog lookup table array;</li><li>genpoly = Generator polynomial array;</li><li>nroots = Number of generator;</li><li>roots = number of parity symbols;</li><li>fcr = First consecutive root, index form;</li><li>prim = Primitive element, index form;</li><li>iprim = prim-th root of 1, index form;</li><li>pad = Padding bytes in shortened block;</li><li>gfpoly</ul>.
*/
protected function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad) {
@@ -2719,8 +2694,8 @@ class QRcode {
/**
* modnn
* @param $rs (array) RS values
* @param $x (int) X position
* @param array $rs RS values
* @param int $x X position
* @return int X osition
*/
protected function modnn($rs, $x) {
@@ -2733,12 +2708,12 @@ class QRcode {
/**
* Initialize a Reed-Solomon codec and returns an array of values.
* @param $symsize (int) symbol size, bits
* @param $gfpoly (int) Field generator polynomial coefficients
* @param $fcr (int) first root of RS code generator polynomial, index form
* @param $prim (int) primitive element to generate polynomial roots
* @param $nroots (int) RS code generator polynomial degree (number of roots)
* @param $pad (int) padding bytes at front of shortened block
* @param int $symsize symbol size, bits
* @param int $gfpoly Field generator polynomial coefficients
* @param int $fcr first root of RS code generator polynomial, index form
* @param int $prim primitive element to generate polynomial roots
* @param int $nroots RS code generator polynomial degree (number of roots)
* @param int $pad padding bytes at front of shortened block
* @return array Array of RS values:<ul><li>mm = Bits per symbol;</li><li>nn = Symbols per block;</li><li>alpha_to = log lookup table array;</li><li>index_of = Antilog lookup table array;</li><li>genpoly = Generator polynomial array;</li><li>nroots = Number of generator;</li><li>roots = number of parity symbols;</li><li>fcr = First consecutive root, index form;</li><li>prim = Primitive element, index form;</li><li>iprim = prim-th root of 1, index form;</li><li>pad = Padding bytes in shortened block;</li><li>gfpoly</ul>.
*/
protected function init_rs_char($symsize, $gfpoly, $fcr, $prim, $nroots, $pad) {
@@ -2820,9 +2795,9 @@ class QRcode {
/**
* Encode a Reed-Solomon codec and returns the parity array
* @param $rs (array) RS values
* @param $data (array) data
* @param $parity (array) parity
* @param array $rs RS values
* @param array $data data
* @param array $parity parity
* @return parity array
*/
protected function encode_rs_char($rs, $data, $parity) {