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

Method init

text-to-qr/lib/phpqrcode/qrencode.php:87–127  ·  view source on GitHub ↗

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

(array $spec)

Source from the content-addressed store, hash-verified

85
86 //----------------------------------------------------------------------
87 public function init(array $spec)
88 {
89 $dl = QRspec::rsDataCodes1($spec);
90 $el = QRspec::rsEccCodes1($spec);
91 $rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
92
93
94 $blockNo = 0;
95 $dataPos = 0;
96 $eccPos = 0;
97 for($i=0; $i<QRspec::rsBlockNum1($spec); $i++) {
98 $ecc = array_slice($this->ecccode,$eccPos);
99 $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs);
100 $this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc);
101
102 $dataPos += $dl;
103 $eccPos += $el;
104 $blockNo++;
105 }
106
107 if(QRspec::rsBlockNum2($spec) == 0)
108 return 0;
109
110 $dl = QRspec::rsDataCodes2($spec);
111 $el = QRspec::rsEccCodes2($spec);
112 $rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
113
114 if($rs == NULL) return -1;
115
116 for($i=0; $i<QRspec::rsBlockNum2($spec); $i++) {
117 $ecc = array_slice($this->ecccode,$eccPos);
118 $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs);
119 $this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc);
120
121 $dataPos += $dl;
122 $eccPos += $el;
123 $blockNo++;
124 }
125
126 return 0;
127 }
128
129 //----------------------------------------------------------------------
130 public function getCode()

Callers 9

__constructMethod · 0.95
tilt.jsFile · 0.45
CalendarControlFunction · 0.45
pJSFunction · 0.45
slick.min.jsFile · 0.45
SlickFunction · 0.45
slick.jsFile · 0.45
FidgetSpinner.pyFile · 0.45
CalendarControlFunction · 0.45

Calls 7

rsDataCodes1Method · 0.45
rsEccCodes1Method · 0.45
init_rsMethod · 0.45
rsBlockNum1Method · 0.45
rsBlockNum2Method · 0.45
rsDataCodes2Method · 0.45
rsEccCodes2Method · 0.45

Tested by

no test coverage detected