MCPcopy Create free account
hub / github.com/codemistic/Web-Development / tcpdfBarcodeArray

Method tcpdfBarcodeArray

text-to-qr/lib/phpqrcode/qrtools.php:42–70  ·  view source on GitHub ↗

----------------------------------------------------------------------

($code, $mode = 'QR,L', $tcPdfVersion = '4.5.037')

Source from the content-addressed store, hash-verified

40
41 //----------------------------------------------------------------------
42 public static function tcpdfBarcodeArray($code, $mode = 'QR,L', $tcPdfVersion = '4.5.037')
43 {
44 $barcode_array = array();
45
46 if (!is_array($mode))
47 $mode = explode(',', $mode);
48
49 $eccLevel = 'L';
50
51 if (count($mode) > 1) {
52 $eccLevel = $mode[1];
53 }
54
55 $qrTab = QRcode::text($code, false, $eccLevel);
56 $size = count($qrTab);
57
58 $barcode_array['num_rows'] = $size;
59 $barcode_array['num_cols'] = $size;
60 $barcode_array['bcode'] = array();
61
62 foreach ($qrTab as $line) {
63 $arrAdd = array();
64 foreach(str_split($line) as $char)
65 $arrAdd[] = ($char=='1')?1:0;
66 $barcode_array['bcode'][] = $arrAdd;
67 }
68
69 return $barcode_array;
70 }
71
72 //----------------------------------------------------------------------
73 public static function clearCache()

Callers

nothing calls this directly

Calls 3

countFunction · 0.85
str_splitFunction · 0.85
textMethod · 0.45

Tested by

no test coverage detected