← All changes
|
vendor/tecnickcom/tcpdf/include/barcodes/datamatrix.php
+64
-64
2.3.2
→
4.17.0
View file →
| @@ -4,11 +4,11 @@ | ||
| 4 | 4 | // Version : 1.0.008 |
| 5 | 5 | // Begin : 2010-06-07 |
| 6 | 6 | // Last Update : 2014-05-06 |
| 7 | 7 | // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - [email protected] |
| 8 | -// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) | |
| 8 | +// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html) | |
| 9 | 9 | // ------------------------------------------------------------------- |
| 10 | -// Copyright (C) 2010-2014 Nicola Asuni - Tecnick.com LTD | |
| 10 | +// Copyright (C) 2010-2014 2026 Nicola Asuni - Tecnick.com LTD | |
| 11 | 11 | // |
| 12 | 12 | // This file is part of TCPDF software library. |
| 13 | 13 | // |
| 14 | 14 | // TCPDF is free software: you can redistribute it and/or modify it |
| @@ -21,9 +21,9 @@ | ||
| 21 | 21 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 22 | 22 | // See the GNU Lesser General Public License for more details. |
| 23 | 23 | // |
| 24 | 24 | // You should have received a copy of the GNU Lesser General Public License |
| 25 | -// along with TCPDF. If not, see <http://www.gnu.org/licenses/>. | |
| 25 | +// along with TCPDF. If not, see <https://www.gnu.org/licenses/>. | |
| 26 | 26 | // |
| 27 | 27 | // See LICENSE.TXT file for more information. |
| 28 | 28 | // ------------------------------------------------------------------- |
| 29 | 29 | // |
| @@ -228,9 +228,9 @@ | ||
| 228 | 228 | |
| 229 | 229 | /** |
| 230 | 230 | * This is the class constructor. |
| 231 | 231 | * Creates a datamatrix object |
| 232 | - * @param $code (string) Code to represent using Datamatrix. | |
| 232 | + * @param string $code Code to represent using Datamatrix. | |
| 233 | 233 | * @public |
| 234 | 234 | */ |
| 235 | 235 | public function __construct($code) { |
| 236 | 236 | $barcode_array = array(); |
| @@ -354,13 +354,13 @@ | ||
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | /** |
| 357 | 357 | * Product of two numbers in a Power-of-Two Galois Field |
| 358 | - * @param $a (int) first number to multiply. | |
| 359 | - * @param $b (int) second number to multiply. | |
| 360 | - * @param $log (array) Log table. | |
| 361 | - * @param $alog (array) Anti-Log table. | |
| 362 | - * @param $gf (array) Number of Factors of the Reed-Solomon polynomial. | |
| 358 | + * @param int $a first number to multiply. | |
| 359 | + * @param int $b second number to multiply. | |
| 360 | + * @param array $log Log table. | |
| 361 | + * @param array $alog Anti-Log table. | |
| 362 | + * @param int $gf Number of Factors of the Reed-Solomon polynomial. | |
| 363 | 363 | * @return int product |
| 364 | 364 | * @protected |
| 365 | 365 | */ |
| 366 | 366 | protected function getGFProduct($a, $b, $log, $alog, $gf) { |
| @@ -371,14 +371,14 @@ | ||
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | /** |
| 374 | 374 | * Add error correction codewords to data codewords array (ANNEX E). |
| 375 | - * @param $wd (array) Array of datacodewords. | |
| 376 | - * @param $nb (int) Number of blocks. | |
| 377 | - * @param $nd (int) Number of data codewords per block. | |
| 378 | - * @param $nc (int) Number of correction codewords per block. | |
| 379 | - * @param $gf (int) numner of fields on log/antilog table (power of 2). | |
| 380 | - * @param $pp (int) The value of its prime modulus polynomial (301 for ECC200). | |
| 375 | + * @param array $wd Array of datacodewords. | |
| 376 | + * @param int $nb Number of blocks. | |
| 377 | + * @param int $nd Number of data codewords per block. | |
| 378 | + * @param int $nc Number of correction codewords per block. | |
| 379 | + * @param int $gf numner of fields on log/antilog table (power of 2). | |
| 380 | + * @param int $pp The value of its prime modulus polynomial (301 for ECC200). | |
| 381 | 381 | * @return array data codewords + error codewords |
| 382 | 382 | * @protected |
| 383 | 383 | */ |
| 384 | 384 | protected function getErrorCorrection($wd, $nb, $nd, $nc, $gf=256, $pp=301) { |
| @@ -437,11 +437,11 @@ | ||
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | /** |
| 440 | 440 | * Return the 253-state codeword |
| 441 | - * @param $cwpad (int) Pad codeword. | |
| 442 | - * @param $cwpos (int) Number of data codewords from the beginning of encoded data. | |
| 443 | - * @return pad codeword | |
| 441 | + * @param int $cwpad Pad codeword. | |
| 442 | + * @param int $cwpos Number of data codewords from the beginning of encoded data. | |
| 443 | + * @return int pad codeword | |
| 444 | 444 | * @protected |
| 445 | 445 | */ |
| 446 | 446 | protected function get253StateCodeword($cwpad, $cwpos) { |
| 447 | 447 | $pad = ($cwpad + (((149 * $cwpos) % 253) + 1)); |
| @@ -452,11 +452,11 @@ | ||
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | /** |
| 455 | 455 | * Return the 255-state codeword |
| 456 | - * @param $cwpad (int) Pad codeword. | |
| 457 | - * @param $cwpos (int) Number of data codewords from the beginning of encoded data. | |
| 458 | - * @return pad codeword | |
| 456 | + * @param int $cwpad Pad codeword. | |
| 457 | + * @param int $cwpos Number of data codewords from the beginning of encoded data. | |
| 458 | + * @return int pad codeword | |
| 459 | 459 | * @protected |
| 460 | 460 | */ |
| 461 | 461 | protected function get255StateCodeword($cwpad, $cwpos) { |
| 462 | 462 | $pad = ($cwpad + (((149 * $cwpos) % 255) + 1)); |
| @@ -467,10 +467,10 @@ | ||
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | /** |
| 470 | 470 | * Returns true if the char belongs to the selected mode |
| 471 | - * @param $chr (int) Character (byte) to check. | |
| 472 | - * @param $mode (int) Current encoding mode. | |
| 471 | + * @param int $chr Character (byte) to check. | |
| 472 | + * @param int $mode Current encoding mode. | |
| 473 | 473 | * @return boolean true if the char is of the selected mode. |
| 474 | 474 | * @protected |
| 475 | 475 | */ |
| 476 | 476 | protected function isCharMode($chr, $mode) { |
| @@ -513,11 +513,11 @@ | ||
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | /** |
| 516 | 516 | * The look-ahead test scans the data to be encoded to find the best mode (Annex P - steps from J to S). |
| 517 | - * @param $data (string) data to encode | |
| 518 | - * @param $pos (int) current position | |
| 519 | - * @param $mode (int) current encoding mode | |
| 517 | + * @param string $data data to encode | |
| 518 | + * @param int $pos current position | |
| 519 | + * @param int $mode current encoding mode | |
| 520 | 520 | * @return int encoding mode |
| 521 | 521 | * @protected |
| 522 | 522 | */ |
| 523 | 523 | protected function lookAheadTest($data, $pos, $mode) { |
| @@ -628,9 +628,9 @@ | ||
| 628 | 628 | } |
| 629 | 629 | if ($numch[ENC_C40] == $numch[ENC_X12]) { |
| 630 | 630 | $k = ($pos + $charscount + 1); |
| 631 | 631 | while ($k < $data_length) { |
| 632 | - $tmpchr = ord($data{$k}); | |
| 632 | + $tmpchr = ord($data[$k]); | |
| 633 | 633 | if ($this->isCharMode($tmpchr, ENC_X12)) { |
| 634 | 634 | return ENC_X12; |
| 635 | 635 | } elseif (!($this->isCharMode($tmpchr, ENC_X12) OR $this->isCharMode($tmpchr, ENC_C40))) { |
| 636 | 636 | break; |
| @@ -645,10 +645,10 @@ | ||
| 645 | 645 | } |
| 646 | 646 | |
| 647 | 647 | /** |
| 648 | 648 | * Get the switching codeword to a new encoding mode (latch codeword) |
| 649 | - * @param $mode (int) New encoding mode. | |
| 650 | - * @return (int) Switch codeword. | |
| 649 | + * @param int $mode New encoding mode. | |
| 650 | + * @return int Switch codeword. | |
| 651 | 651 | * @protected |
| 652 | 652 | */ |
| 653 | 653 | protected function getSwitchEncodingCodeword($mode) { |
| 654 | 654 | switch ($mode) { |
| @@ -684,10 +684,10 @@ | ||
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | /** |
| 687 | 687 | * Choose the minimum matrix size and return the max number of data codewords. |
| 688 | - * @param $numcw (int) Number of current codewords. | |
| 689 | - * @return number of data codewords in matrix | |
| 688 | + * @param int $numcw Number of current codewords. | |
| 689 | + * @return int number of data codewords in matrix | |
| 690 | 690 | * @protected |
| 691 | 691 | */ |
| 692 | 692 | protected function getMaxDataCodewords($numcw) { |
| 693 | 693 | foreach ($this->symbattr as $key => $matrix) { |
| @@ -699,9 +699,9 @@ | ||
| 699 | 699 | } |
| 700 | 700 | |
| 701 | 701 | /** |
| 702 | 702 | * Get high level encoding using the minimum symbol data characters for ECC 200 |
| 703 | - * @param $data (string) data to encode | |
| 703 | + * @param string $data data to encode | |
| 704 | 704 | * @return array of codewords |
| 705 | 705 | * @protected |
| 706 | 706 | */ |
| 707 | 707 | protected function getHighLevelEncoding($data) { |
| @@ -777,9 +777,9 @@ | ||
| 777 | 777 | } else { |
| 778 | 778 | if (isset($this->chset['SH1'][$chr])) { |
| 779 | 779 | $temp_cw[] = 0; // shift 1 |
| 780 | 780 | $shiftset = $this->chset['SH1']; |
| 781 | - } elseif (isset($chr, $this->chset['SH2'][$chr])) { | |
| 781 | + } elseif (isset($this->chset['SH2'][$chr])) { | |
| 782 | 782 | $temp_cw[] = 1; // shift 2 |
| 783 | 783 | $shiftset = $this->chset['SH2']; |
| 784 | 784 | } elseif (($enc == ENC_C40) AND isset($this->chset['S3C'][$chr])) { |
| 785 | 785 | $temp_cw[] = 2; // shift 3 |
| @@ -969,15 +969,15 @@ | ||
| 969 | 969 | |
| 970 | 970 | /** |
| 971 | 971 | * Places "chr+bit" with appropriate wrapping within array[]. |
| 972 | 972 | * (Annex F - ECC 200 symbol character placement) |
| 973 | - * @param $marr (array) Array of symbols. | |
| 974 | - * @param $nrow (int) Number of rows. | |
| 975 | - * @param $ncol (int) Number of columns. | |
| 976 | - * @param $row (int) Row number. | |
| 977 | - * @param $col (int) Column number. | |
| 978 | - * @param $chr (int) Char byte. | |
| 979 | - * @param $bit (int) Bit. | |
| 973 | + * @param array $marr Array of symbols. | |
| 974 | + * @param int $nrow Number of rows. | |
| 975 | + * @param int $ncol Number of columns. | |
| 976 | + * @param int $row Row number. | |
| 977 | + * @param int $col Column number. | |
| 978 | + * @param int $chr Char byte. | |
| 979 | + * @param int $bit Bit. | |
| 980 | 980 | * @return array |
| 981 | 981 | * @protected |
| 982 | 982 | */ |
| 983 | 983 | protected function placeModule($marr, $nrow, $ncol, $row, $col, $chr, $bit) { |
| @@ -995,14 +995,14 @@ | ||
| 995 | 995 | |
| 996 | 996 | /** |
| 997 | 997 | * Places the 8 bits of a utah-shaped symbol character. |
| 998 | 998 | * (Annex F - ECC 200 symbol character placement) |
| 999 | - * @param $marr (array) Array of symbols. | |
| 1000 | - * @param $nrow (int) Number of rows. | |
| 1001 | - * @param $ncol (int) Number of columns. | |
| 1002 | - * @param $row (int) Row number. | |
| 1003 | - * @param $col (int) Column number. | |
| 1004 | - * @param $chr (int) Char byte. | |
| 999 | + * @param array $marr Array of symbols. | |
| 1000 | + * @param int $nrow Number of rows. | |
| 1001 | + * @param int $ncol Number of columns. | |
| 1002 | + * @param int $row Row number. | |
| 1003 | + * @param int $col Column number. | |
| 1004 | + * @param int $chr Char byte. | |
| 1005 | 1005 | * @return array |
| 1006 | 1006 | * @protected |
| 1007 | 1007 | */ |
| 1008 | 1008 | protected function placeUtah($marr, $nrow, $ncol, $row, $col, $chr) { |
| @@ -1019,12 +1019,12 @@ | ||
| 1019 | 1019 | |
| 1020 | 1020 | /** |
| 1021 | 1021 | * Places the 8 bits of the first special corner case. |
| 1022 | 1022 | * (Annex F - ECC 200 symbol character placement) |
| 1023 | - * @param $marr (array) Array of symbols. | |
| 1024 | - * @param $nrow (int) Number of rows. | |
| 1025 | - * @param $ncol (int) Number of columns. | |
| 1026 | - * @param $chr (int) Char byte. | |
| 1023 | + * @param array $marr Array of symbols. | |
| 1024 | + * @param int $nrow Number of rows. | |
| 1025 | + * @param int $ncol Number of columns. | |
| 1026 | + * @param int $chr Char byte. | |
| 1027 | 1027 | * @return array |
| 1028 | 1028 | * @protected |
| 1029 | 1029 | */ |
| 1030 | 1030 | protected function placeCornerA($marr, $nrow, $ncol, $chr) { |
| @@ -1041,12 +1041,12 @@ | ||
| 1041 | 1041 | |
| 1042 | 1042 | /** |
| 1043 | 1043 | * Places the 8 bits of the second special corner case. |
| 1044 | 1044 | * (Annex F - ECC 200 symbol character placement) |
| 1045 | - * @param $marr (array) Array of symbols. | |
| 1046 | - * @param $nrow (int) Number of rows. | |
| 1047 | - * @param $ncol (int) Number of columns. | |
| 1048 | - * @param $chr (int) Char byte. | |
| 1045 | + * @param array $marr Array of symbols. | |
| 1046 | + * @param int $nrow Number of rows. | |
| 1047 | + * @param int $ncol Number of columns. | |
| 1048 | + * @param int $chr Char byte. | |
| 1049 | 1049 | * @return array |
| 1050 | 1050 | * @protected |
| 1051 | 1051 | */ |
| 1052 | 1052 | protected function placeCornerB($marr, $nrow, $ncol, $chr) { |
| @@ -1063,12 +1063,12 @@ | ||
| 1063 | 1063 | |
| 1064 | 1064 | /** |
| 1065 | 1065 | * Places the 8 bits of the third special corner case. |
| 1066 | 1066 | * (Annex F - ECC 200 symbol character placement) |
| 1067 | - * @param $marr (array) Array of symbols. | |
| 1068 | - * @param $nrow (int) Number of rows. | |
| 1069 | - * @param $ncol (int) Number of columns. | |
| 1070 | - * @param $chr (int) Char byte. | |
| 1067 | + * @param array $marr Array of symbols. | |
| 1068 | + * @param int $nrow Number of rows. | |
| 1069 | + * @param int $ncol Number of columns. | |
| 1070 | + * @param int $chr Char byte. | |
| 1071 | 1071 | * @return array |
| 1072 | 1072 | * @protected |
| 1073 | 1073 | */ |
| 1074 | 1074 | protected function placeCornerC($marr, $nrow, $ncol, $chr) { |
| @@ -1085,12 +1085,12 @@ | ||
| 1085 | 1085 | |
| 1086 | 1086 | /** |
| 1087 | 1087 | * Places the 8 bits of the fourth special corner case. |
| 1088 | 1088 | * (Annex F - ECC 200 symbol character placement) |
| 1089 | - * @param $marr (array) Array of symbols. | |
| 1090 | - * @param $nrow (int) Number of rows. | |
| 1091 | - * @param $ncol (int) Number of columns. | |
| 1092 | - * @param $chr (int) Char byte. | |
| 1089 | + * @param array $marr Array of symbols. | |
| 1090 | + * @param int $nrow Number of rows. | |
| 1091 | + * @param int $ncol Number of columns. | |
| 1092 | + * @param int $chr Char byte. | |
| 1093 | 1093 | * @return array |
| 1094 | 1094 | * @protected |
| 1095 | 1095 | */ |
| 1096 | 1096 | protected function placeCornerD($marr, $nrow, $ncol, $chr) { |
| @@ -1107,10 +1107,10 @@ | ||
| 1107 | 1107 | |
| 1108 | 1108 | /** |
| 1109 | 1109 | * Build a placement map. |
| 1110 | 1110 | * (Annex F - ECC 200 symbol character placement) |
| 1111 | - * @param $nrow (int) Number of rows. | |
| 1112 | - * @param $ncol (int) Number of columns. | |
| 1111 | + * @param int $nrow Number of rows. | |
| 1112 | + * @param int $ncol Number of columns. | |
| 1113 | 1113 | * @return array |
| 1114 | 1114 | * @protected |
| 1115 | 1115 | */ |
| 1116 | 1116 | protected function getPlacementMap($nrow, $ncol) { |