PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.18.0
GiveWP – Donation Plugin and Fundraising Platform v4.18.0
4.18.0 4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 All 257 releases
← All changes | vendor/tecnickcom/tcpdf/tcpdf_barcodes_1d.php +129 -128 2.3.0 → 4.18.0 View file →
@@ -4,11 +4,11 @@
4 4 // Version : 1.0.027
5 5 // Begin : 2008-06-09
6 6 // Last Update : 2014-10-20
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) 2008-2014 Nicola Asuni - Tecnick.com LTD
10 +// Copyright (C) 2008-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 //
@@ -52,9 +52,9 @@
52 52 /**
53 53 * Array representation of barcode.
54 54 * @protected
55 55 */
56 - protected $barcode_array;
56 + protected $barcode_array = array();
57 57
58 58 /**
59 59 * This is the class constructor.
60 60 * Return an array representations for common 1D barcodes:<ul>
@@ -65,10 +65,10 @@
65 65 * <li>$arrcode['bcode'][$k]['t'] bar type: true = bar, false = space.</li>
66 66 * <li>$arrcode['bcode'][$k]['w'] bar width in units.</li>
67 67 * <li>$arrcode['bcode'][$k]['h'] bar height in units.</li>
68 68 * <li>$arrcode['bcode'][$k]['p'] bar top position (0 = top, 1 = middle)</li></ul>
69 - * @param $code (string) code to print
70 - * @param $type (string) type of barcode: <ul><li>C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.</li><li>C39+ : CODE 39 with checksum</li><li>C39E : CODE 39 EXTENDED</li><li>C39E+ : CODE 39 EXTENDED + CHECKSUM</li><li>C93 : CODE 93 - USS-93</li><li>S25 : Standard 2 of 5</li><li>S25+ : Standard 2 of 5 + CHECKSUM</li><li>I25 : Interleaved 2 of 5</li><li>I25+ : Interleaved 2 of 5 + CHECKSUM</li><li>C128 : CODE 128</li><li>C128A : CODE 128 A</li><li>C128B : CODE 128 B</li><li>C128C : CODE 128 C</li><li>EAN2 : 2-Digits UPC-Based Extension</li><li>EAN5 : 5-Digits UPC-Based Extension</li><li>EAN8 : EAN 8</li><li>EAN13 : EAN 13</li><li>UPCA : UPC-A</li><li>UPCE : UPC-E</li><li>MSI : MSI (Variation of Plessey code)</li><li>MSI+ : MSI + CHECKSUM (modulo 11)</li><li>POSTNET : POSTNET</li><li>PLANET : PLANET</li><li>RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)</li><li>KIX : KIX (Klant index - Customer index)</li><li>IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200</li><li>CODABAR : CODABAR</li><li>CODE11 : CODE 11</li><li>PHARMA : PHARMACODE</li><li>PHARMA2T : PHARMACODE TWO-TRACKS</li></ul>
69 + * @param string $code code to print
70 + * @param string $type type of barcode: <ul><li>C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.</li><li>C39+ : CODE 39 with checksum</li><li>C39E : CODE 39 EXTENDED</li><li>C39E+ : CODE 39 EXTENDED + CHECKSUM</li><li>C93 : CODE 93 - USS-93</li><li>S25 : Standard 2 of 5</li><li>S25+ : Standard 2 of 5 + CHECKSUM</li><li>I25 : Interleaved 2 of 5</li><li>I25+ : Interleaved 2 of 5 + CHECKSUM</li><li>C128 : CODE 128</li><li>C128A : CODE 128 A</li><li>C128B : CODE 128 B</li><li>C128C : CODE 128 C</li><li>EAN2 : 2-Digits UPC-Based Extension</li><li>EAN5 : 5-Digits UPC-Based Extension</li><li>EAN8 : EAN 8</li><li>EAN13 : EAN 13</li><li>UPCA : UPC-A</li><li>UPCE : UPC-E</li><li>MSI : MSI (Variation of Plessey code)</li><li>MSI+ : MSI + CHECKSUM (modulo 11)</li><li>POSTNET : POSTNET</li><li>PLANET : PLANET</li><li>RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)</li><li>KIX : KIX (Klant index - Customer index)</li><li>IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200</li><li>CODABAR : CODABAR</li><li>CODE11 : CODE 11</li><li>PHARMA : PHARMACODE</li><li>PHARMA2T : PHARMACODE TWO-TRACKS</li></ul>
71 71 * @public
72 72 */
73 73 public function __construct($code, $type) {
74 74 $this->setBarcode($code, $type);
@@ -84,11 +84,11 @@
84 84 }
85 85
86 86 /**
87 87 * Send barcode as SVG image object to the standard output.
88 - * @param $w (int) Minimum width of a single bar in user units.
89 - * @param $h (int) Height of barcode in user units.
90 - * @param $color (string) Foreground color (in SVG format) for bar elements (background is transparent).
88 + * @param int $w Minimum width of a single bar in user units.
89 + * @param int $h Height of barcode in user units.
90 + * @param string $color Foreground color (in SVG format) for bar elements (background is transparent).
91 91 * @public
92 92 */
93 93 public function getBarcodeSVG($w=2, $h=30, $color='black') {
94 94 // send headers
@@ -104,11 +104,11 @@
104 104 }
105 105
106 106 /**
107 107 * Return a SVG string representation of barcode.
108 - * @param $w (int) Minimum width of a single bar in user units.
109 - * @param $h (int) Height of barcode in user units.
110 - * @param $color (string) Foreground color (in SVG format) for bar elements (background is transparent).
108 + * @param int $w Minimum width of a single bar in user units.
109 + * @param int $h Height of barcode in user units.
110 + * @param string $color Foreground color (in SVG format) for bar elements (background is transparent).
111 111 * @return string SVG code.
112 112 * @public
113 113 */
114 114 public function getBarcodeSVGcode($w=2, $h=30, $color='black') {
@@ -137,11 +137,11 @@
137 137 }
138 138
139 139 /**
140 140 * Return an HTML representation of barcode.
141 - * @param $w (int) Width of a single bar element in pixels.
142 - * @param $h (int) Height of a single bar element in pixels.
143 - * @param $color (string) Foreground color for bar elements (background is transparent).
141 + * @param int $w Width of a single bar element in pixels.
142 + * @param int $h Height of a single bar element in pixels.
143 + * @param string $color Foreground color for bar elements (background is transparent).
144 144 * @return string HTML code.
145 145 * @public
146 146 */
147 147 public function getBarcodeHTML($w=2, $h=30, $color='black') {
@@ -163,11 +163,11 @@
163 163 }
164 164
165 165 /**
166 166 * Send a PNG image representation of barcode (requires GD or Imagick library).
167 - * @param $w (int) Width of a single bar element in pixels.
168 - * @param $h (int) Height of a single bar element in pixels.
169 - * @param $color (array) RGB (0-255) foreground color for bar elements (background is transparent).
167 + * @param int $w Width of a single bar element in pixels.
168 + * @param int $h Height of a single bar element in pixels.
169 + * @param array $color RGB (0-255) foreground color for bar elements (background is transparent).
170 170 * @public
171 171 */
172 172 public function getBarcodePNG($w=2, $h=30, $color=array(0,0,0)) {
173 173 $data = $this->getBarcodePngData($w, $h, $color);
@@ -182,12 +182,12 @@
182 182 }
183 183
184 184 /**
185 185 * Return a PNG image representation of barcode (requires GD or Imagick library).
186 - * @param $w (int) Width of a single bar element in pixels.
187 - * @param $h (int) Height of a single bar element in pixels.
188 - * @param $color (array) RGB (0-255) foreground color for bar elements (background is transparent).
189 - * @return image or false in case of error.
186 + * @param int $w Width of a single bar element in pixels.
187 + * @param int $h Height of a single bar element in pixels.
188 + * @param array $color RGB (0-255) foreground color for bar elements (background is transparent).
189 + * @return string|Imagick|false image or false in case of error.
190 190 * @public
191 191 */
192 192 public function getBarcodePngData($w=2, $h=30, $color=array(0,0,0)) {
193 193 // calculate image size
@@ -233,9 +233,11 @@
233 233 } else {
234 234 ob_start();
235 235 imagepng($png);
236 236 $imagedata = ob_get_clean();
237 - imagedestroy($png);
237 + if (PHP_VERSION_ID < 80000) {
238 + imagedestroy($png);
239 + }
238 240 return $imagedata;
239 241 }
240 242 }
241 243
@@ -240,11 +242,11 @@
240 242 }
241 243
242 244 /**
243 245 * Set the barcode.
244 - * @param $code (string) code to print
245 - * @param $type (string) type of barcode: <ul><li>C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.</li><li>C39+ : CODE 39 with checksum</li><li>C39E : CODE 39 EXTENDED</li><li>C39E+ : CODE 39 EXTENDED + CHECKSUM</li><li>C93 : CODE 93 - USS-93</li><li>S25 : Standard 2 of 5</li><li>S25+ : Standard 2 of 5 + CHECKSUM</li><li>I25 : Interleaved 2 of 5</li><li>I25+ : Interleaved 2 of 5 + CHECKSUM</li><li>C128 : CODE 128</li><li>C128A : CODE 128 A</li><li>C128B : CODE 128 B</li><li>C128C : CODE 128 C</li><li>EAN2 : 2-Digits UPC-Based Extension</li><li>EAN5 : 5-Digits UPC-Based Extension</li><li>EAN8 : EAN 8</li><li>EAN13 : EAN 13</li><li>UPCA : UPC-A</li><li>UPCE : UPC-E</li><li>MSI : MSI (Variation of Plessey code)</li><li>MSI+ : MSI + CHECKSUM (modulo 11)</li><li>POSTNET : POSTNET</li><li>PLANET : PLANET</li><li>RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)</li><li>KIX : KIX (Klant index - Customer index)</li><li>IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200</li><li>IMBPRE: Pre-processed Intelligent Mail Barcode - Onecode - USPS-B-3200, using only F,A,D,T letters</li><li>CODABAR : CODABAR</li><li>CODE11 : CODE 11</li><li>PHARMA : PHARMACODE</li><li>PHARMA2T : PHARMACODE TWO-TRACKS</li></ul>
246 - * @return array barcode array
246 + * @param string $code code to print
247 + * @param string $type type of barcode: <ul><li>C39 : CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.</li><li>C39+ : CODE 39 with checksum</li><li>C39E : CODE 39 EXTENDED</li><li>C39E+ : CODE 39 EXTENDED + CHECKSUM</li><li>C93 : CODE 93 - USS-93</li><li>S25 : Standard 2 of 5</li><li>S25+ : Standard 2 of 5 + CHECKSUM</li><li>I25 : Interleaved 2 of 5</li><li>I25+ : Interleaved 2 of 5 + CHECKSUM</li><li>C128 : CODE 128</li><li>C128A : CODE 128 A</li><li>C128B : CODE 128 B</li><li>C128C : CODE 128 C</li><li>EAN2 : 2-Digits UPC-Based Extension</li><li>EAN5 : 5-Digits UPC-Based Extension</li><li>EAN8 : EAN 8</li><li>EAN13 : EAN 13</li><li>UPCA : UPC-A</li><li>UPCE : UPC-E</li><li>MSI : MSI (Variation of Plessey code)</li><li>MSI+ : MSI + CHECKSUM (modulo 11)</li><li>POSTNET : POSTNET</li><li>PLANET : PLANET</li><li>RMS4CC : RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)</li><li>KIX : KIX (Klant index - Customer index)</li><li>IMB: Intelligent Mail Barcode - Onecode - USPS-B-3200</li><li>IMBPRE: Pre-processed Intelligent Mail Barcode - Onecode - USPS-B-3200, using only F,A,D,T letters</li><li>CODABAR : CODABAR</li><li>CODE11 : CODE 11</li><li>PHARMA : PHARMACODE</li><li>PHARMA2T : PHARMACODE TWO-TRACKS</li></ul>
248 + * @return void
247 249 * @public
248 250 */
249 251 public function setBarcode($code, $type) {
250 252 switch (strtoupper($type)) {
@@ -372,9 +374,9 @@
372 374 $arrcode = $this->barcode_pharmacode2t($code);
373 375 break;
374 376 }
375 377 default: {
376 - $this->barcode_array = false;
378 + $this->barcode_array = array();
377 379 $arrcode = false;
378 380 break;
379 381 }
380 382 }
@@ -383,11 +385,11 @@
383 385
384 386 /**
385 387 * CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9.
386 388 * General-purpose code in very wide use world-wide
387 - * @param $code (string) code to represent.
388 - * @param $extended (boolean) if true uses the extended mode.
389 - * @param $checksum (boolean) if true add a checksum to the code.
389 + * @param string $code code to represent.
390 + * @param boolean $extended if true uses the extended mode.
391 + * @param boolean $checksum if true add a checksum to the code.
390 392 * @return array barcode representation.
391 393 * @protected
392 394 */
393 395 protected function barcode_code39($code, $extended=false, $checksum=false) {
@@ -452,9 +454,9 @@
452 454 $bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
453 455 $k = 0;
454 456 $clen = strlen($code);
455 457 for ($i = 0; $i < $clen; ++$i) {
456 - $char = $code{$i};
458 + $char = $code[$i];
457 459 if(!isset($chr[$char])) {
458 460 // invalid character
459 461 return false;
460 462 }
@@ -463,9 +465,9 @@
463 465 $t = true; // bar
464 466 } else {
465 467 $t = false; // space
466 468 }
467 - $w = $chr[$char]{$j};
469 + $w = $chr[$char][$j];
468 470 $bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
469 471 $bararray['maxw'] += $w;
470 472 ++$k;
471 473 }
@@ -478,10 +480,10 @@
478 480 }
479 481
480 482 /**
481 483 * Encode a string to be used for CODE 39 Extended mode.
482 - * @param $code (string) code to represent.
483 - * @return encoded string.
484 + * @param string $code code to represent.
485 + * @return string encoded string.
484 486 * @protected
485 487 */
486 488 protected function encode_code39_ext($code) {
487 489 $encode = array(
@@ -519,12 +521,12 @@
519 521 chr(124) => '%Q', chr(125) => '%R', chr(126) => '%S', chr(127) => '%T');
520 522 $code_ext = '';
521 523 $clen = strlen($code);
522 524 for ($i = 0 ; $i < $clen; ++$i) {
523 - if (ord($code{$i}) > 127) {
525 + if (ord($code[$i]) > 127) {
524 526 return false;
525 527 }
526 - $code_ext .= $encode[$code{$i}];
528 + $code_ext .= $encode[$code[$i]];
527 529 }
528 530 return $code_ext;
529 531 }
530 532
@@ -529,10 +531,10 @@
529 531 }
530 532
531 533 /**
532 534 * Calculate CODE 39 checksum (modulo 43).
533 - * @param $code (string) code to represent.
534 - * @return char checksum.
535 + * @param string $code code to represent.
536 + * @return string char checksum.
535 537 * @protected
536 538 */
537 539 protected function checksum_code39($code) {
538 540 $chars = array(
@@ -542,9 +544,9 @@
542 544 'W', 'X', 'Y', 'Z', '-', '.', ' ', '$', '/', '+', '%');
543 545 $sum = 0;
544 546 $clen = strlen($code);
545 547 for ($i = 0 ; $i < $clen; ++$i) {
546 - $k = array_keys($chars, $code{$i});
548 + $k = array_keys($chars, $code[$i]);
547 549 $sum += $k[0];
548 550 }
549 551 $j = ($sum % 43);
550 552 return $chars[$j];
@@ -552,9 +554,9 @@
552 554
553 555 /**
554 556 * CODE 93 - USS-93
555 557 * Compact code similar to Code 39
556 - * @param $code (string) code to represent.
558 + * @param string $code code to represent.
557 559 * @return array barcode representation.
558 560 * @protected
559 561 */
560 562 protected function barcode_code93($code) {
@@ -642,12 +644,12 @@
642 644 chr(124) => chr(131).'Q', chr(125) => chr(131).'R', chr(126) => chr(131).'S', chr(127) => chr(131).'T');
643 645 $code_ext = '';
644 646 $clen = strlen($code);
645 647 for ($i = 0 ; $i < $clen; ++$i) {
646 - if (ord($code{$i}) > 127) {
648 + if (ord($code[$i]) > 127) {
647 649 return false;
648 650 }
649 - $code_ext .= $encode[$code{$i}];
651 + $code_ext .= $encode[$code[$i]];
650 652 }
651 653 // checksum
652 654 $code_ext .= $this->checksum_code93($code_ext);
653 655 // add start and stop codes
@@ -655,9 +657,9 @@
655 657 $bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
656 658 $k = 0;
657 659 $clen = strlen($code);
658 660 for ($i = 0; $i < $clen; ++$i) {
659 - $char = ord($code{$i});
661 + $char = ord($code[$i]);
660 662 if(!isset($chr[$char])) {
661 663 // invalid character
662 664 return false;
663 665 }
@@ -666,9 +668,9 @@
666 668 $t = true; // bar
667 669 } else {
668 670 $t = false; // space
669 671 }
670 - $w = $chr[$char]{$j};
672 + $w = $chr[$char][$j];
671 673 $bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
672 674 $bararray['maxw'] += $w;
673 675 ++$k;
674 676 }
@@ -680,9 +682,9 @@
680 682 }
681 683
682 684 /**
683 685 * Calculate CODE 93 checksum (modulo 47).
684 - * @param $code (string) code to represent.
686 + * @param string $code code to represent.
685 687 * @return string checksum code.
686 688 * @protected
687 689 */
688 690 protected function checksum_code93($code) {
@@ -698,9 +700,9 @@
698 700 // calculate check digit C
699 701 $p = 1;
700 702 $check = 0;
701 703 for ($i = ($len - 1); $i >= 0; --$i) {
702 - $k = array_keys($chars, $code{$i});
704 + $k = array_keys($chars, $code[$i]);
703 705 $check += ($k[0] * $p);
704 706 ++$p;
705 707 if ($p > 20) {
706 708 $p = 1;
@@ -712,9 +714,9 @@
712 714 // calculate check digit K
713 715 $p = 1;
714 716 $check = 0;
715 717 for ($i = $len; $i >= 0; --$i) {
716 - $k = array_keys($chars, $code{$i});
718 + $k = array_keys($chars, $code[$i]);
717 719 $check += ($k[0] * $p);
718 720 ++$p;
719 721 if ($p > 15) {
720 722 $p = 1;
@@ -729,9 +731,9 @@
729 731 }
730 732
731 733 /**
732 734 * Checksum for standard 2 of 5 barcodes.
733 - * @param $code (string) code to process.
735 + * @param string $code code to process.
734 736 * @return int checksum.
735 737 * @protected
736 738 */
737 739 protected function checksum_s25($code) {
@@ -737,13 +739,13 @@
737 739 protected function checksum_s25($code) {
738 740 $len = strlen($code);
739 741 $sum = 0;
740 742 for ($i = 0; $i < $len; $i+=2) {
741 - $sum += $code{$i};
743 + $sum += $code[$i];
742 744 }
743 745 $sum *= 3;
744 746 for ($i = 1; $i < $len; $i+=2) {
745 - $sum += ($code{$i});
747 + $sum += ($code[$i]);
746 748 }
747 749 $r = $sum % 10;
748 750 if($r > 0) {
749 751 $r = (10 - $r);
@@ -754,10 +756,10 @@
754 756 /**
755 757 * MSI.
756 758 * Variation of Plessey code, with similar applications
757 759 * Contains digits (0 to 9) and encodes the data only in the width of bars.
758 - * @param $code (string) code to represent.
759 - * @param $checksum (boolean) if true add a checksum to the code (modulo 11)
760 + * @param string $code code to represent.
761 + * @param boolean $checksum if true add a checksum to the code (modulo 11)
760 762 * @return array barcode representation.
761 763 * @protected
762 764 */
763 765 protected function barcode_msi($code, $checksum=false) {
@@ -782,9 +784,9 @@
782 784 $clen = strlen($code);
783 785 $p = 2;
784 786 $check = 0;
785 787 for ($i = ($clen - 1); $i >= 0; --$i) {
786 - $check += (hexdec($code{$i}) * $p);
788 + $check += (hexdec($code[$i]) * $p);
787 789 ++$p;
788 790 if ($p > 7) {
789 791 $p = 2;
790 792 }
@@ -797,9 +799,9 @@
797 799 }
798 800 $seq = '110'; // left guard
799 801 $clen = strlen($code);
800 802 for ($i = 0; $i < $clen; ++$i) {
801 - $digit = $code{$i};
803 + $digit = $code[$i];
802 804 if (!isset($chr[$digit])) {
803 805 // invalid character
804 806 return false;
805 807 }
@@ -813,10 +815,10 @@
813 815 /**
814 816 * Standard 2 of 5 barcodes.
815 817 * Used in airline ticket marking, photofinishing
816 818 * Contains digits (0 to 9) and encodes the data only in the width of bars.
817 - * @param $code (string) code to represent.
818 - * @param $checksum (boolean) if true add a checksum to the code
819 + * @param string $code code to represent.
820 + * @param boolean $checksum if true add a checksum to the code
819 821 * @return array barcode representation.
820 822 * @protected
821 823 */
822 824 protected function barcode_s25($code, $checksum=false) {
@@ -827,9 +829,9 @@
827 829 $chr['4'] = '10101110101110';
828 830 $chr['5'] = '11101011101010';
829 831 $chr['6'] = '10111011101010';
830 832 $chr['7'] = '10101011101110';
831 - $chr['8'] = '10101110111010';
833 + $chr['8'] = '11101010111010';
832 834 $chr['9'] = '10111010111010';
833 835 if ($checksum) {
834 836 // add checksum
835 837 $code .= $this->checksum_s25($code);
@@ -837,12 +839,12 @@
837 839 if((strlen($code) % 2) != 0) {
838 840 // add leading zero if code-length is odd
839 841 $code = '0'.$code;
840 842 }
841 - $seq = '11011010';
843 + $seq = '1110111010';
842 844 $clen = strlen($code);
843 845 for ($i = 0; $i < $clen; ++$i) {
844 - $digit = $code{$i};
846 + $digit = $code[$i];
845 847 if (!isset($chr[$digit])) {
846 848 // invalid character
847 849 return false;
848 850 }
@@ -847,18 +849,17 @@
847 849 return false;
848 850 }
849 851 $seq .= $chr[$digit];
850 852 }
851 - $seq .= '1101011';
853 + $seq .= '111010111';
852 854 $bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
853 855 return $this->binseq_to_array($seq, $bararray);
854 856 }
855 857
856 858 /**
857 - * Convert binary barcode sequence to TCPDF barcode array.
858 - * @param $seq (string) barcode as binary sequence.
859 - * @param $bararray (array) barcode array.
860 - * òparam array $bararray TCPDF barcode array to fill up
859 + * Convert binary barcode sequence to WarnockPDF barcode array.
860 + * @param string $seq barcode as binary sequence.
861 + * @param array $bararray barcode array to fill up
861 862 * @return array barcode representation.
862 863 * @protected
863 864 */
864 865 protected function binseq_to_array($seq, $bararray) {
@@ -866,10 +867,10 @@
866 867 $w = 0;
867 868 $k = 0;
868 869 for ($i = 0; $i < $len; ++$i) {
869 870 $w += 1;
870 - if (($i == ($len - 1)) OR (($i < ($len - 1)) AND ($seq{$i} != $seq{($i+1)}))) {
871 - if ($seq{$i} == '1') {
871 + if (($i == ($len - 1)) OR (($i < ($len - 1)) AND ($seq[$i] != $seq[($i+1)]))) {
872 + if ($seq[$i] == '1') {
872 873 $t = true; // bar
873 874 } else {
874 875 $t = false; // space
875 876 }
@@ -885,10 +886,10 @@
885 886 /**
886 887 * Interleaved 2 of 5 barcodes.
887 888 * Compact numeric code, widely used in industry, air cargo
888 889 * Contains digits (0 to 9) and encodes the data in the width of both bars and spaces.
889 - * @param $code (string) code to represent.
890 - * @param $checksum (boolean) if true add a checksum to the code
890 + * @param string $code code to represent.
891 + * @param boolean $checksum if true add a checksum to the code
891 892 * @return array barcode representation.
892 893 * @protected
893 894 */
894 895 protected function barcode_i25($code, $checksum=false) {
@@ -918,10 +919,10 @@
918 919 $bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
919 920 $k = 0;
920 921 $clen = strlen($code);
921 922 for ($i = 0; $i < $clen; $i = ($i + 2)) {
922 - $char_bar = $code{$i};
923 - $char_space = $code{$i+1};
923 + $char_bar = $code[$i];
924 + $char_space = $code[$i+1];
924 925 if((!isset($chr[$char_bar])) OR (!isset($chr[$char_space]))) {
925 926 // invalid character
926 927 return false;
927 928 }
@@ -928,9 +929,9 @@
928 929 // create a bar-space sequence
929 930 $seq = '';
930 931 $chrlen = strlen($chr[$char_bar]);
931 932 for ($s = 0; $s < $chrlen; $s++){
932 - $seq .= $chr[$char_bar]{$s} . $chr[$char_space]{$s};
933 + $seq .= $chr[$char_bar][$s] . $chr[$char_space][$s];
933 934 }
934 935 $seqlen = strlen($seq);
935 936 for ($j = 0; $j < $seqlen; ++$j) {
936 937 if (($j % 2) == 0) {
@@ -937,9 +938,9 @@
937 938 $t = true; // bar
938 939 } else {
939 940 $t = false; // space
940 941 }
941 - $w = $seq{$j};
942 + $w = (float)$seq[$j];
942 943 $bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
943 944 $bararray['maxw'] += $w;
944 945 ++$k;
945 946 }
@@ -949,10 +950,10 @@
949 950
950 951 /**
951 952 * C128 barcodes.
952 953 * Very capable code, excellent density, high reliability; in very wide use world-wide
953 - * @param $code (string) code to represent.
954 - * @param $type (string) barcode type: A, B, C or empty for automatic switch (AUTO mode)
954 + * @param string $code code to represent.
955 + * @param string $type barcode type: A, B, C or empty for automatic switch (AUTO mode)
955 956 * @return array barcode representation.
956 957 * @protected
957 958 */
958 959 protected function barcode_c128($code, $type='') {
@@ -1084,9 +1085,9 @@
1084 1085 switch(strtoupper($type)) {
1085 1086 case 'A': { // MODE A
1086 1087 $startid = 103;
1087 1088 for ($i = 0; $i < $len; ++$i) {
1088 - $char = $code{$i};
1089 + $char = $code[$i];
1089 1090 $char_id = ord($char);
1090 1091 if (($char_id >= 241) AND ($char_id <= 244)) {
1091 1092 $code_data[] = $fnc_a[$char_id];
1092 1093 } elseif (($char_id >= 0) AND ($char_id <= 95)) {
@@ -1099,9 +1100,9 @@
1099 1100 }
1100 1101 case 'B': { // MODE B
1101 1102 $startid = 104;
1102 1103 for ($i = 0; $i < $len; ++$i) {
1103 - $char = $code{$i};
1104 + $char = $code[$i];
1104 1105 $char_id = ord($char);
1105 1106 if (($char_id >= 241) AND ($char_id <= 244)) {
1106 1107 $code_data[] = $fnc_b[$char_id];
1107 1108 } elseif (($char_id >= 32) AND ($char_id <= 127)) {
@@ -1123,9 +1124,9 @@
1123 1124 // the length must be even
1124 1125 return false;
1125 1126 }
1126 1127 for ($i = 0; $i < $len; $i+=2) {
1127 - $chrnum = $code{$i}.$code{$i+1};
1128 + $chrnum = $code[$i].$code[$i+1];
1128 1129 if (preg_match('/([0-9]{2})/', $chrnum) > 0) {
1129 1130 $code_data[] = intval($chrnum);
1130 1131 } else {
1131 1132 return false;
@@ -1179,9 +1180,9 @@
1179 1180 $code_data[] = 101;
1180 1181 }
1181 1182 }
1182 1183 for ($i = 0; $i < $seq[2]; ++$i) {
1183 - $char = $seq[1]{$i};
1184 + $char = $seq[1][$i];
1184 1185 $char_id = ord($char);
1185 1186 if (($char_id >= 241) AND ($char_id <= 244)) {
1186 1187 $code_data[] = $fnc_a[$char_id];
1187 1188 } else {
@@ -1222,9 +1223,9 @@
1222 1223 $code_data[] = 100;
1223 1224 }
1224 1225 }
1225 1226 for ($i = 0; $i < $seq[2]; ++$i) {
1226 - $char = $seq[1]{$i};
1227 + $char = $seq[1][$i];
1227 1228 $char_id = ord($char);
1228 1229 if (($char_id >= 241) AND ($char_id <= 244)) {
1229 1230 $code_data[] = $fnc_b[$char_id];
1230 1231 } else {
@@ -1239,9 +1240,9 @@
1239 1240 } elseif ($sequence[($key - 1)][0] != 'C') {
1240 1241 $code_data[] = 99;
1241 1242 }
1242 1243 for ($i = 0; $i < $seq[2]; $i+=2) {
1243 - $chrnum = $seq[1]{$i}.$seq[1]{$i+1};
1244 + $chrnum = $seq[1][$i].$seq[1][$i+1];
1244 1245 $code_data[] = intval($chrnum);
1245 1246 }
1246 1247 break;
1247 1248 }
@@ -1270,9 +1271,9 @@
1270 1271 $t = true; // bar
1271 1272 } else {
1272 1273 $t = false; // space
1273 1274 }
1274 - $w = $seq{$j};
1275 + $w = (float)$seq[$j];
1275 1276 $bararray['bcode'][] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
1276 1277 $bararray['maxw'] += $w;
1277 1278 }
1278 1279 }
@@ -1280,9 +1281,9 @@
1280 1281 }
1281 1282
1282 1283 /**
1283 1284 * Split text code in A/B sequence for 128 code
1284 - * @param $code (string) code to split.
1285 + * @param string $code code to split.
1285 1286 * @return array sequence
1286 1287 * @protected
1287 1288 */
1288 1289 protected function get128ABsequence($code) {
@@ -1318,10 +1319,10 @@
1318 1319 * EAN13 and UPC-A barcodes.
1319 1320 * EAN13: European Article Numbering international retail product code
1320 1321 * UPC-A: Universal product code seen on almost all retail products in the USA and Canada
1321 1322 * UPC-E: Short version of UPC symbol
1322 - * @param $code (string) code to represent.
1323 - * @param $len (string) barcode type: 6 = UPC-E, 8 = EAN8, 13 = EAN13, 12 = UPC-A
1323 + * @param string $code code to represent.
1324 + * @param string $len barcode type: 6 = UPC-E, 8 = EAN8, 13 = EAN13, 12 = UPC-A
1324 1325 * @return array barcode representation.
1325 1326 * @protected
1326 1327 */
1327 1328 protected function barcode_eanupc($code, $len=13) {
@@ -1336,9 +1337,9 @@
1336 1337 $code_len = strlen($code);
1337 1338 // calculate check digit
1338 1339 $sum_a = 0;
1339 1340 for ($i = 1; $i < $data_len; $i+=2) {
1340 - $sum_a += $code{$i};
1341 + $sum_a += $code[$i];
1341 1342 }
1342 1343 if ($len > 12) {
1343 1344 $sum_a *= 3;
1344 1345 }
@@ -1343,9 +1344,9 @@
1343 1344 $sum_a *= 3;
1344 1345 }
1345 1346 $sum_b = 0;
1346 1347 for ($i = 0; $i < $data_len; $i+=2) {
1347 - $sum_b += ($code{$i});
1348 + $sum_b += ($code[$i]);
1348 1349 }
1349 1350 if ($len < 13) {
1350 1351 $sum_b *= 3;
1351 1352 }
@@ -1355,9 +1356,9 @@
1355 1356 }
1356 1357 if ($code_len == $data_len) {
1357 1358 // add check digit
1358 1359 $code .= $r;
1359 - } elseif ($r !== intval($code{$data_len})) {
1360 + } elseif ($r !== intval($code[$data_len])) {
1360 1361 // wrong checkdigit
1361 1362 return false;
1362 1363 }
1363 1364 if ($len == 12) {
@@ -1466,9 +1467,9 @@
1466 1467 if ($upce) {
1467 1468 $bararray = array('code' => $upce_code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
1468 1469 $p = $upce_parities[$code[1]][$r];
1469 1470 for ($i = 0; $i < 6; ++$i) {
1470 - $seq .= $codes[$p[$i]][$upce_code{$i}];
1471 + $seq .= $codes[$p[$i]][$upce_code[$i]];
1471 1472 }
1472 1473 $seq .= '010101'; // right guard bar
1473 1474 } else {
1474 1475 $bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
@@ -1474,19 +1475,19 @@
1474 1475 $bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
1475 1476 $half_len = intval(ceil($len / 2));
1476 1477 if ($len == 8) {
1477 1478 for ($i = 0; $i < $half_len; ++$i) {
1478 - $seq .= $codes['A'][$code{$i}];
1479 + $seq .= $codes['A'][$code[$i]];
1479 1480 }
1480 1481 } else {
1481 1482 $p = $parities[$code[0]];
1482 1483 for ($i = 1; $i < $half_len; ++$i) {
1483 - $seq .= $codes[$p[$i-1]][$code{$i}];
1484 + $seq .= $codes[$p[$i-1]][$code[$i]];
1484 1485 }
1485 1486 }
1486 1487 $seq .= '01010'; // center guard bar
1487 1488 for ($i = $half_len; $i < $len; ++$i) {
1488 - $seq .= $codes['C'][$code{$i}];
1489 + $seq .= $codes['C'][$code[$i]];
1489 1490 }
1490 1491 $seq .= '101'; // right guard bar
1491 1492 }
1492 1493 $clen = strlen($seq);
@@ -1492,10 +1493,10 @@
1492 1493 $clen = strlen($seq);
1493 1494 $w = 0;
1494 1495 for ($i = 0; $i < $clen; ++$i) {
1495 1496 $w += 1;
1496 - if (($i == ($clen - 1)) OR (($i < ($clen - 1)) AND ($seq{$i} != $seq{($i+1)}))) {
1497 - if ($seq{$i} == '1') {
1497 + if (($i == ($clen - 1)) OR (($i < ($clen - 1)) AND ($seq[$i] != $seq[$i+1]))) {
1498 + if ($seq[$i] == '1') {
1498 1499 $t = true; // bar
1499 1500 } else {
1500 1501 $t = false; // space
1501 1502 }
@@ -1511,10 +1512,10 @@
1511 1512 /**
1512 1513 * UPC-Based Extensions
1513 1514 * 2-Digit Ext.: Used to indicate magazines and newspaper issue numbers
1514 1515 * 5-Digit Ext.: Used to mark suggested retail price of books
1515 - * @param $code (string) code to represent.
1516 - * @param $len (string) barcode type: 2 = 2-Digit, 5 = 5-Digit
1516 + * @param string $code code to represent.
1517 + * @param string $len barcode type: 2 = 2-Digit, 5 = 5-Digit
1517 1518 * @return array barcode representation.
1518 1519 * @protected
1519 1520 */
1520 1521 protected function barcode_eanext($code, $len=5) {
@@ -1577,9 +1578,9 @@
1577 1578 $seq = '1011'; // left guard bar
1578 1579 $seq .= $codes[$p[0]][$code[0]];
1579 1580 for ($i = 1; $i < $len; ++$i) {
1580 1581 $seq .= '01'; // separator
1581 - $seq .= $codes[$p[$i]][$code{$i}];
1582 + $seq .= $codes[$p[$i]][$code[$i]];
1582 1583 }
1583 1584 $bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
1584 1585 return $this->binseq_to_array($seq, $bararray);
1585 1586 }
@@ -1586,10 +1587,10 @@
1586 1587
1587 1588 /**
1588 1589 * POSTNET and PLANET barcodes.
1589 1590 * Used by U.S. Postal Service for automated mail sorting
1590 - * @param $code (string) zip code to represent. Must be a string containing a zip code of the form DDDDD or DDDDD-DDDD.
1591 - * @param $planet (boolean) if true print the PLANET barcode, otherwise print POSTNET
1591 + * @param string $code zip code to represent. Must be a string containing a zip code of the form DDDDD or DDDDD-DDDD.
1592 + * @param boolean $planet if true print the PLANET barcode, otherwise print POSTNET
1592 1593 * @return array barcode representation.
1593 1594 * @protected
1594 1595 */
1595 1596 protected function barcode_postnet($code, $planet=false) {
@@ -1628,9 +1629,9 @@
1628 1629 $len = strlen($code);
1629 1630 // calculate checksum
1630 1631 $sum = 0;
1631 1632 for ($i = 0; $i < $len; ++$i) {
1632 - $sum += intval($code{$i});
1633 + $sum += intval($code[$i]);
1633 1634 }
1634 1635 $chkd = ($sum % 10);
1635 1636 if($chkd > 0) {
1636 1637 $chkd = (10 - $chkd);
@@ -1642,9 +1643,9 @@
1642 1643 $bararray['bcode'][$k++] = array('t' => 0, 'w' => 1, 'h' => 2, 'p' => 0);
1643 1644 $bararray['maxw'] += 2;
1644 1645 for ($i = 0; $i < $len; ++$i) {
1645 1646 for ($j = 0; $j < 5; ++$j) {
1646 - $h = $barlen[$code{$i}][$j];
1647 + $h = $barlen[$code[$i]][$j];
1647 1648 $p = floor(1 / $h);
1648 1649 $bararray['bcode'][$k++] = array('t' => 1, 'w' => 1, 'h' => $h, 'p' => $p);
1649 1650 $bararray['bcode'][$k++] = array('t' => 0, 'w' => 1, 'h' => 2, 'p' => 0);
1650 1651 $bararray['maxw'] += 2;
@@ -1659,10 +1660,10 @@
1659 1660 /**
1660 1661 * RMS4CC - CBC - KIX
1661 1662 * RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code) - KIX (Klant index - Customer index)
1662 1663 * RM4SCC is the name of the barcode symbology used by the Royal Mail for its Cleanmail service.
1663 - * @param $code (string) code to print
1664 - * @param $kix (boolean) if true prints the KIX variation (doesn't use the start and end symbols, and the checksum) - in this case the house number must be sufficed with an X and placed at the end of the code.
1664 + * @param string $code code to print
1665 + * @param boolean $kix if true prints the KIX variation (doesn't use the start and end symbols, and the checksum) - in this case the house number must be sufficed with an X and placed at the end of the code.
1665 1666 * @return array barcode representation.
1666 1667 * @protected
1667 1668 */
1668 1669 protected function barcode_rms4cc($code, $kix=false) {
@@ -1755,10 +1756,10 @@
1755 1756 );
1756 1757 $row = 0;
1757 1758 $col = 0;
1758 1759 for ($i = 0; $i < $len; ++$i) {
1759 - $row += $checktable[$code{$i}][0];
1760 - $col += $checktable[$code{$i}][1];
1760 + $row += $checktable[$code[$i]][0];
1761 + $col += $checktable[$code[$i]][1];
1761 1762 }
1762 1763 $row %= 6;
1763 1764 $col %= 6;
1764 1765 $chk = array_keys($checktable, array($row,$col));
@@ -1773,9 +1774,9 @@
1773 1774 $bararray['maxw'] += 2;
1774 1775 }
1775 1776 for ($i = 0; $i < $len; ++$i) {
1776 1777 for ($j = 0; $j < 4; ++$j) {
1777 - switch ($barmode[$code{$i}][$j]) {
1778 + switch ($barmode[$code[$i]][$j]) {
1778 1779 case 1: {
1779 1780 $p = 0;
1780 1781 $h = 2;
1781 1782 break;
@@ -1811,9 +1812,9 @@
1811 1812
1812 1813 /**
1813 1814 * CODABAR barcodes.
1814 1815 * Older code often used in library systems, sometimes in blood banks
1815 - * @param $code (string) code to represent.
1816 + * @param string $code code to represent.
1816 1817 * @return array barcode representation.
1817 1818 * @protected
1818 1819 */
1819 1820 protected function barcode_codabar($code) {
@@ -1845,12 +1846,12 @@
1845 1846 $seq = '';
1846 1847 $code = 'A'.strtoupper($code).'A';
1847 1848 $len = strlen($code);
1848 1849 for ($i = 0; $i < $len; ++$i) {
1849 - if (!isset($chr[$code{$i}])) {
1850 + if (!isset($chr[$code[$i]])) {
1850 1851 return false;
1851 1852 }
1852 - $seq = $chr[$code{$i}];
1853 + $seq = $chr[$code[$i]];
1853 1854 for ($j = 0; $j < 8; ++$j) {
1854 1855 if (($j % 2) == 0) {
1855 1856 $t = true; // bar
1856 1857 } else {
@@ -1855,9 +1856,9 @@
1855 1856 $t = true; // bar
1856 1857 } else {
1857 1858 $t = false; // space
1858 1859 }
1859 - $w = $seq{$j};
1860 + $w = (float)$seq[$j];
1860 1861 $bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
1861 1862 $bararray['maxw'] += $w;
1862 1863 ++$k;
1863 1864 }
@@ -1867,9 +1868,9 @@
1867 1868
1868 1869 /**
1869 1870 * CODE11 barcodes.
1870 1871 * Used primarily for labeling telecommunications equipment
1871 - * @param $code (string) code to represent.
1872 + * @param string $code code to represent.
1872 1873 * @return array barcode representation.
1873 1874 * @protected
1874 1875 */
1875 1876 protected function barcode_code11($code) {
@@ -1895,9 +1896,9 @@
1895 1896 // calculate check digit C
1896 1897 $p = 1;
1897 1898 $check = 0;
1898 1899 for ($i = ($len - 1); $i >= 0; --$i) {
1899 - $digit = $code{$i};
1900 + $digit = $code[$i];
1900 1901 if ($digit == '-') {
1901 1902 $dval = 10;
1902 1903 } else {
1903 1904 $dval = intval($digit);
@@ -1917,9 +1918,9 @@
1917 1918 // calculate check digit K
1918 1919 $p = 1;
1919 1920 $check = 0;
1920 1921 for ($i = $len; $i >= 0; --$i) {
1921 - $digit = $code{$i};
1922 + $digit = $code[$i];
1922 1923 if ($digit == '-') {
1923 1924 $dval = 10;
1924 1925 } else {
1925 1926 $dval = intval($digit);
@@ -1936,12 +1937,12 @@
1936 1937 }
1937 1938 $code = 'S'.$code.'S';
1938 1939 $len += 3;
1939 1940 for ($i = 0; $i < $len; ++$i) {
1940 - if (!isset($chr[$code{$i}])) {
1941 + if (!isset($chr[$code[$i]])) {
1941 1942 return false;
1942 1943 }
1943 - $seq = $chr[$code{$i}];
1944 + $seq = $chr[$code[$i]];
1944 1945 for ($j = 0; $j < 6; ++$j) {
1945 1946 if (($j % 2) == 0) {
1946 1947 $t = true; // bar
1947 1948 } else {
@@ -1946,9 +1947,9 @@
1946 1947 $t = true; // bar
1947 1948 } else {
1948 1949 $t = false; // space
1949 1950 }
1950 - $w = $seq{$j};
1951 + $w = (float)$seq[$j];
1951 1952 $bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
1952 1953 $bararray['maxw'] += $w;
1953 1954 ++$k;
1954 1955 }
@@ -1958,9 +1959,9 @@
1958 1959
1959 1960 /**
1960 1961 * Pharmacode
1961 1962 * Contains digits (0 to 9)
1962 - * @param $code (string) code to represent.
1963 + * @param string $code code to represent.
1963 1964 * @return array barcode representation.
1964 1965 * @protected
1965 1966 */
1966 1967 protected function barcode_pharmacode($code) {
@@ -1984,9 +1985,9 @@
1984 1985
1985 1986 /**
1986 1987 * Pharmacode two-track
1987 1988 * Contains digits (0 to 9)
1988 - * @param $code (string) code to represent.
1989 + * @param string $code code to represent.
1989 1990 * @return array barcode representation.
1990 1991 * @protected
1991 1992 */
1992 1993 protected function barcode_pharmacode2t($code) {
@@ -2015,9 +2016,9 @@
2015 2016 $k = 0;
2016 2017 $bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 2, 'bcode' => array());
2017 2018 $len = strlen($seq);
2018 2019 for ($i = 0; $i < $len; ++$i) {
2019 - switch ($seq{$i}) {
2020 + switch ($seq[$i]) {
2020 2021 case '1': {
2021 2022 $p = 1;
2022 2023 $h = 1;
2023 2024 break;
@@ -2046,9 +2047,9 @@
2046 2047 * IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200
2047 2048 * (requires PHP bcmath extension)
2048 2049 * Intelligent Mail barcode is a 65-bar code for use on mail in the United States.
2049 2050 * The fields are described as follows:<ul><li>The Barcode Identifier shall be assigned by USPS to encode the presort identification that is currently printed in human readable form on the optional endorsement line (OEL) as well as for future USPS use. This shall be two digits, with the second digit in the range of 0–4. The allowable encoding ranges shall be 00–04, 10–14, 20–24, 30–34, 40–44, 50–54, 60–64, 70–74, 80–84, and 90–94.</li><li>The Service Type Identifier shall be assigned by USPS for any combination of services requested on the mailpiece. The allowable encoding range shall be 000http://it2.php.net/manual/en/function.dechex.php–999. Each 3-digit value shall correspond to a particular mail class with a particular combination of service(s). Each service program, such as OneCode Confirm and OneCode ACS, shall provide the list of Service Type Identifier values.</li><li>The Mailer or Customer Identifier shall be assigned by USPS as a unique, 6 or 9 digit number that identifies a business entity. The allowable encoding range for the 6 digit Mailer ID shall be 000000- 899999, while the allowable encoding range for the 9 digit Mailer ID shall be 900000000-999999999.</li><li>The Serial or Sequence Number shall be assigned by the mailer for uniquely identifying and tracking mailpieces. The allowable encoding range shall be 000000000–999999999 when used with a 6 digit Mailer ID and 000000-999999 when used with a 9 digit Mailer ID. e. The Delivery Point ZIP Code shall be assigned by the mailer for routing the mailpiece. This shall replace POSTNET for routing the mailpiece to its final delivery point. The length may be 0, 5, 9, or 11 digits. The allowable encoding ranges shall be no ZIP Code, 00000–99999, 000000000–999999999, and 00000000000–99999999999.</li></ul>
2050 - * @param $code (string) code to print, separate the ZIP (routing code) from the rest using a minus char '-' (BarcodeID_ServiceTypeID_MailerID_SerialNumber-RoutingCode)
2051 + * @param string $code code to print, separate the ZIP (routing code) from the rest using a minus char '-' (BarcodeID_ServiceTypeID_MailerID_SerialNumber-RoutingCode)
2051 2052 * @return array barcode representation.
2052 2053 * @protected
2053 2054 */
2054 2055 protected function barcode_imb($code) {
@@ -2170,10 +2171,10 @@
2170 2171 }
2171 2172
2172 2173 /**
2173 2174 * IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200
2174 - *
2175 - * @param $code (string) pre-formatted IMB barcode (65 chars "FADT")
2175 + *
2176 + * @param string $code pre-formatted IMB barcode (65 chars "FADT")
2176 2177 * @return array barcode representation.
2177 2178 * @protected
2178 2179 */
2179 2180 protected function barcode_imb_pre($code) {
@@ -2222,9 +2223,9 @@
2222 2223
2223 2224 /**
2224 2225 * Convert large integer number to hexadecimal representation.
2225 2226 * (requires PHP bcmath extension)
2226 - * @param $number (string) number to convert specified as a string
2227 + * @param string $number number to convert specified as a string
2227 2228 * @return string hexadecimal representation
2228 2229 */
2229 2230 public function dec_to_hex($number) {
2230 2231 $i = 0;
@@ -2246,9 +2247,9 @@
2246 2247
2247 2248 /**
2248 2249 * Convert large hexadecimal number to decimal representation (string).
2249 2250 * (requires PHP bcmath extension)
2250 - * @param $hex (string) hexadecimal number to convert specified as a string
2251 + * @param string $hex hexadecimal number to convert specified as a string
2251 2252 * @return string hexadecimal representation
2252 2253 */
2253 2254 public function hex_to_dec($hex) {
2254 2255 $dec = 0;
@@ -2254,9 +2255,9 @@
2254 2255 $dec = 0;
2255 2256 $bitval = 1;
2256 2257 $len = strlen($hex);
2257 2258 for($pos = ($len - 1); $pos >= 0; --$pos) {
2258 - $dec = bcadd($dec, bcmul(hexdec($hex{$pos}), $bitval));
2259 + $dec = bcadd($dec, bcmul(hexdec($hex[$pos]), $bitval));
2259 2260 $bitval = bcmul($bitval, 16);
2260 2261 }
2261 2262 return $dec;
2262 2263 }
@@ -2262,9 +2263,9 @@
2262 2263 }
2263 2264
2264 2265 /**
2265 2266 * Intelligent Mail Barcode calculation of Frame Check Sequence
2266 - * @param $code_arr (string) array of hexadecimal values (13 bytes holding 102 bits right justified).
2267 + * @param string $code_arr array of hexadecimal values (13 bytes holding 102 bits right justified).
2267 2268 * @return int 11 bit Frame Check Sequence as integer (decimal base)
2268 2269 * @protected
2269 2270 */
2270 2271 protected function imb_crc11fcs($code_arr) {
@@ -2298,9 +2299,9 @@
2298 2299 }
2299 2300
2300 2301 /**
2301 2302 * Reverse unsigned short value
2302 - * @param $num (int) value to reversr
2303 + * @param int $num value to reversr
2303 2304 * @return int reversed value
2304 2305 * @protected
2305 2306 */
2306 2307 protected function imb_reverse_us($num) {
@@ -2314,10 +2315,10 @@
2314 2315 }
2315 2316
2316 2317 /**
2317 2318 * generate Nof13 tables used for Intelligent Mail Barcode
2318 - * @param $n (int) is the type of table: 2 for 2of13 table, 5 for 5of13table
2319 - * @param $size (int) size of table (78 for n=2 and 1287 for n=5)
2319 + * @param int $n is the type of table: 2 for 2of13 table, 5 for 5of13table
2320 + * @param int $size size of table (78 for n=2 and 1287 for n=5)
2320 2321 * @return array requested table
2321 2322 * @protected
2322 2323 */
2323 2324 protected function imb_tables($n, $size) {