@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | { |
33 | 33 | $link_halaman = ''; |
34 | 34 | |
35 | - if (($halaman_aktif - 1) > 0) { |
|
35 | + if (($halaman_aktif - 1)>0) { |
|
36 | 36 | $previous = $halaman_aktif - 1; |
37 | 37 | |
38 | 38 | $link_halaman .= "<a href=$_SERVER[PHP_SELF]?module=$_GET[module]&halaman=$previous title=Previous><<</a> "; |
@@ -66,30 +66,30 @@ discard block |
||
66 | 66 | |
67 | 67 | /// |
68 | 68 | |
69 | - $angka = ($halaman > 3 ? ' ... ' : ' '); |
|
70 | - for ($i = $halaman - 2; $i < $halaman; $i++) { |
|
71 | - if ($i < 1) { |
|
69 | + $angka = ($halaman>3 ? ' ... ' : ' '); |
|
70 | + for ($i = $halaman - 2; $i<$halaman; $i++) { |
|
71 | + if ($i<1) { |
|
72 | 72 | continue; |
73 | 73 | } |
74 | 74 | $angka .= "<a href=$_SERVER[PHP_SELF]?halaman=$i>$i</A> "; |
75 | 75 | } |
76 | 76 | |
77 | 77 | $angka .= " <b>$halaman</b> "; |
78 | - for ($i = $halaman + 1; $i < ($halaman + 3); $i++) { |
|
79 | - if ($i > $jmlhalaman) { |
|
78 | + for ($i = $halaman + 1; $i<($halaman + 3); $i++) { |
|
79 | + if ($i>$jmlhalaman) { |
|
80 | 80 | break; |
81 | 81 | } |
82 | 82 | $angka .= "<a href=$_SERVER[PHP_SELF]?module=$_GET[module]&halaman=$i>$i</A> "; |
83 | 83 | } |
84 | 84 | |
85 | - $angka .= ($halaman + 2 < $jmlhalaman ? " ... |
|
85 | + $angka .= ($halaman + 2<$jmlhalaman ? " ... |
|
86 | 86 | <a href=$_SERVER[PHP_SELF]?module=$_GET[module]&halaman=$jmlhalaman>$jmlhalaman</A> " : ' '); |
87 | 87 | |
88 | 88 | echo "$angka"; |
89 | 89 | |
90 | 90 | // Link Next dan Last |
91 | 91 | |
92 | - if ($halaman_aktif < $jmlhalaman) { |
|
92 | + if ($halaman_aktif<$jmlhalaman) { |
|
93 | 93 | $next = $halaman_aktif + 1; |
94 | 94 | |
95 | 95 | $link_halaman .= " <a href=$_SERVER[PHP_SELF]?module=$_GET[module]&halaman=$next title=Next>>></a> "; |
@@ -30,22 +30,22 @@ discard block |
||
30 | 30 | |
31 | 31 | class QRrsItem |
32 | 32 | { |
33 | - public $mm; // Bits per symbol |
|
34 | - public $nn; // Symbols per block (= (1<<mm)-1) |
|
35 | - public $alpha_to = []; // log lookup table |
|
36 | - public $index_of = []; // Antilog lookup table |
|
37 | - public $genpoly = []; // Generator polynomial |
|
38 | - public $nroots; // Number of generator roots = number of parity symbols |
|
39 | - public $fcr; // First consecutive root, index form |
|
40 | - public $prim; // Primitive element, index form |
|
41 | - public $iprim; // prim-th root of 1, index form |
|
42 | - public $pad; // Padding bytes in shortened block |
|
33 | + public $mm; // Bits per symbol |
|
34 | + public $nn; // Symbols per block (= (1<<mm)-1) |
|
35 | + public $alpha_to = []; // log lookup table |
|
36 | + public $index_of = []; // Antilog lookup table |
|
37 | + public $genpoly = []; // Generator polynomial |
|
38 | + public $nroots; // Number of generator roots = number of parity symbols |
|
39 | + public $fcr; // First consecutive root, index form |
|
40 | + public $prim; // Primitive element, index form |
|
41 | + public $iprim; // prim-th root of 1, index form |
|
42 | + public $pad; // Padding bytes in shortened block |
|
43 | 43 | public $gfpoly; |
44 | 44 | |
45 | 45 | //---------------------------------------------------------------------- |
46 | 46 | public function modnn($x) |
47 | 47 | { |
48 | - while ($x >= $this->nn) { |
|
48 | + while ($x>=$this->nn) { |
|
49 | 49 | $x -= $this->nn; |
50 | 50 | $x = ($x >> $this->mm) + ($x & $this->nn); |
51 | 51 | } |
@@ -63,19 +63,19 @@ discard block |
||
63 | 63 | $rs = null; |
64 | 64 | |
65 | 65 | // Check parameter ranges |
66 | - if ($symsize < 0 || $symsize > 8) { |
|
66 | + if ($symsize<0 || $symsize>8) { |
|
67 | 67 | return $rs; |
68 | 68 | } |
69 | - if ($fcr < 0 || $fcr >= (1 << $symsize)) { |
|
69 | + if ($fcr<0 || $fcr>=(1 << $symsize)) { |
|
70 | 70 | return $rs; |
71 | 71 | } |
72 | - if ($prim <= 0 || $prim >= (1 << $symsize)) { |
|
72 | + if ($prim<=0 || $prim>=(1 << $symsize)) { |
|
73 | 73 | return $rs; |
74 | 74 | } |
75 | - if ($nroots < 0 || $nroots >= (1 << $symsize)) { |
|
75 | + if ($nroots<0 || $nroots>=(1 << $symsize)) { |
|
76 | 76 | return $rs; |
77 | 77 | } // Can't have more roots than symbol values! |
78 | - if ($pad < 0 || $pad >= ((1 << $symsize) - 1 - $nroots)) { |
|
78 | + if ($pad<0 || $pad>=((1 << $symsize) - 1 - $nroots)) { |
|
79 | 79 | return $rs; |
80 | 80 | } // Too much padding |
81 | 81 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $rs->alpha_to[$A0] = 0; // alpha**-inf = 0 |
97 | 97 | $sr = 1; |
98 | 98 | |
99 | - for ($i = 0; $i < $rs->nn; $i++) { |
|
99 | + for ($i = 0; $i<$rs->nn; $i++) { |
|
100 | 100 | $rs->index_of[$sr] = $i; |
101 | 101 | $rs->alpha_to[$i] = $sr; |
102 | 102 | $sr <<= 1; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $sr &= $rs->nn; |
107 | 107 | } |
108 | 108 | |
109 | - if ($sr != 1) { |
|
109 | + if ($sr!=1) { |
|
110 | 110 | // field generator polynomial is not primitive! |
111 | 111 | $rs = null; |
112 | 112 | |
@@ -122,17 +122,17 @@ discard block |
||
122 | 122 | $rs->gfpoly = $gfpoly; |
123 | 123 | |
124 | 124 | /* Find prim-th root of 1, used in decoding */ |
125 | - for ($iprim = 1; ($iprim % $prim) != 0; $iprim += $rs->nn); // intentional empty-body loop! |
|
125 | + for ($iprim = 1; ($iprim % $prim)!=0; $iprim += $rs->nn); // intentional empty-body loop! |
|
126 | 126 | |
127 | - $rs->iprim = (int) ($iprim / $prim); |
|
127 | + $rs->iprim = (int)($iprim / $prim); |
|
128 | 128 | $rs->genpoly[0] = 1; |
129 | 129 | |
130 | - for ($i = 0,$root = $fcr * $prim; $i < $nroots; $i++, $root += $prim) { |
|
130 | + for ($i = 0, $root = $fcr * $prim; $i<$nroots; $i++, $root += $prim) { |
|
131 | 131 | $rs->genpoly[$i + 1] = 1; |
132 | 132 | |
133 | 133 | // Multiply rs->genpoly[] by @**(root + x) |
134 | - for ($j = $i; $j > 0; $j--) { |
|
135 | - if ($rs->genpoly[$j] != 0) { |
|
134 | + for ($j = $i; $j>0; $j--) { |
|
135 | + if ($rs->genpoly[$j]!=0) { |
|
136 | 136 | $rs->genpoly[$j] = $rs->genpoly[$j - 1] ^ $rs->alpha_to[$rs->modnn($rs->index_of[$rs->genpoly[$j]] + $root)]; |
137 | 137 | } else { |
138 | 138 | $rs->genpoly[$j] = $rs->genpoly[$j - 1]; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | // convert rs->genpoly[] to index form for quicker encoding |
146 | - for ($i = 0; $i <= $nroots; $i++) { |
|
146 | + for ($i = 0; $i<=$nroots; $i++) { |
|
147 | 147 | $rs->genpoly[$i] = $rs->index_of[$rs->genpoly[$i]]; |
148 | 148 | } |
149 | 149 | |
@@ -167,23 +167,23 @@ discard block |
||
167 | 167 | |
168 | 168 | $parity = array_fill(0, $NROOTS, 0); |
169 | 169 | |
170 | - for ($i = 0; $i < ($NN - $NROOTS - $PAD); $i++) { |
|
170 | + for ($i = 0; $i<($NN - $NROOTS - $PAD); $i++) { |
|
171 | 171 | $feedback = $INDEX_OF[$data[$i] ^ $parity[0]]; |
172 | - if ($feedback != $A0) { |
|
172 | + if ($feedback!=$A0) { |
|
173 | 173 | // feedback term is non-zero |
174 | 174 | |
175 | 175 | // This line is unnecessary when GENPOLY[NROOTS] is unity, as it must |
176 | 176 | // always be for the polynomials constructed by init_rs() |
177 | 177 | $feedback = $this->modnn($NN - $GENPOLY[$NROOTS] + $feedback); |
178 | 178 | |
179 | - for ($j = 1; $j < $NROOTS; $j++) { |
|
179 | + for ($j = 1; $j<$NROOTS; $j++) { |
|
180 | 180 | $parity[$j] ^= $ALPHA_TO[$this->modnn($feedback + $GENPOLY[$NROOTS - $j])]; |
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | 184 | // Shift |
185 | 185 | array_shift($parity); |
186 | - if ($feedback != $A0) { |
|
186 | + if ($feedback!=$A0) { |
|
187 | 187 | array_push($parity, $ALPHA_TO[$this->modnn($feedback + $GENPOLY[0])]); |
188 | 188 | } else { |
189 | 189 | array_push($parity, 0); |
@@ -202,22 +202,22 @@ discard block |
||
202 | 202 | public static function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad) |
203 | 203 | { |
204 | 204 | foreach (self::$items as $rs) { |
205 | - if ($rs->pad != $pad) { |
|
205 | + if ($rs->pad!=$pad) { |
|
206 | 206 | continue; |
207 | 207 | } |
208 | - if ($rs->nroots != $nroots) { |
|
208 | + if ($rs->nroots!=$nroots) { |
|
209 | 209 | continue; |
210 | 210 | } |
211 | - if ($rs->mm != $symsize) { |
|
211 | + if ($rs->mm!=$symsize) { |
|
212 | 212 | continue; |
213 | 213 | } |
214 | - if ($rs->gfpoly != $gfpoly) { |
|
214 | + if ($rs->gfpoly!=$gfpoly) { |
|
215 | 215 | continue; |
216 | 216 | } |
217 | - if ($rs->fcr != $fcr) { |
|
217 | + if ($rs->fcr!=$fcr) { |
|
218 | 218 | continue; |
219 | 219 | } |
220 | - if ($rs->prim != $prim) { |
|
220 | + if ($rs->prim!=$prim) { |
|
221 | 221 | continue; |
222 | 222 | } |
223 | 223 |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | { |
32 | 32 | $vect = self::vectEPS($frame, $pixelPerPoint, $outerFrame, $back_color, $fore_color, $cmyk); |
33 | 33 | |
34 | - if ($filename === false) { |
|
34 | + if ($filename===false) { |
|
35 | 35 | header('Content-Type: application/postscript'); |
36 | 36 | header('Content-Disposition: filename="qrcode.eps"'); |
37 | 37 | echo $vect; |
38 | 38 | } else { |
39 | - if ($saveandprint === true) { |
|
39 | + if ($saveandprint===true) { |
|
40 | 40 | QRtools::save($vect, $filename); |
41 | 41 | header('Content-Type: application/postscript'); |
42 | 42 | header('Content-Disposition: filename="qrcode.eps"'); |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | |
113 | 113 | // Convert the matrix into pixels |
114 | 114 | |
115 | - for ($i = 0; $i < $h; $i++) { |
|
116 | - for ($j = 0; $j < $w; $j++) { |
|
117 | - if ($frame[$i][$j] == '1') { |
|
115 | + for ($i = 0; $i<$h; $i++) { |
|
116 | + for ($j = 0; $j<$w; $j++) { |
|
117 | + if ($frame[$i][$j]=='1') { |
|
118 | 118 | $y = $h - 1 - $i; |
119 | 119 | $x = $j; |
120 | 120 | $output .= $x.' '.$y.' 1 1 F'."\n"; |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | { |
133 | 133 | $vect = self::vectSVG($frame, $pixelPerPoint, $outerFrame, $back_color, $fore_color); |
134 | 134 | |
135 | - if ($filename === false) { |
|
135 | + if ($filename===false) { |
|
136 | 136 | header('Content-Type: image/svg+xml'); |
137 | 137 | //header('Content-Disposition: attachment, filename="qrcode.svg"'); |
138 | 138 | echo $vect; |
139 | 139 | } else { |
140 | - if ($saveandprint === true) { |
|
140 | + if ($saveandprint===true) { |
|
141 | 141 | QRtools::save($vect, $filename); |
142 | 142 | header('Content-Type: image/svg+xml'); |
143 | 143 | //header('Content-Disposition: filename="'.$filename.'"'); |
@@ -182,9 +182,9 @@ discard block |
||
182 | 182 | |
183 | 183 | // Convert the matrix into pixels |
184 | 184 | |
185 | - for ($i = 0; $i < $h; $i++) { |
|
186 | - for ($j = 0; $j < $w; $j++) { |
|
187 | - if ($frame[$i][$j] == '1') { |
|
185 | + for ($i = 0; $i<$h; $i++) { |
|
186 | + for ($j = 0; $j<$w; $j++) { |
|
187 | + if ($frame[$i][$j]=='1') { |
|
188 | 188 | $y = ($i + $outerFrame) * $pixelPerPoint; |
189 | 189 | $x = ($j + $outerFrame) * $pixelPerPoint; |
190 | 190 | $output .= '<use x="'.$x.'" y="'.$y.'" xlink:href="#p" />'."\n"; |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | |
50 | 50 | $matrixPointSize = 4; |
51 | 51 | if (isset($_REQUEST['size'])) { |
52 | - $matrixPointSize = min(max((int) $_REQUEST['size'], 1), 10); |
|
52 | + $matrixPointSize = min(max((int)$_REQUEST['size'], 1), 10); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | if (isset($_REQUEST['data'])) { |
56 | 56 | |
57 | 57 | //it's very important! |
58 | - if (trim($_REQUEST['data']) == '') { |
|
58 | + if (trim($_REQUEST['data'])=='') { |
|
59 | 59 | die('data cannot be empty! <a href="?">back</a>'); |
60 | 60 | } |
61 | 61 | |
@@ -76,15 +76,15 @@ discard block |
||
76 | 76 | echo '<form action="index.php" method="post"> |
77 | 77 | Data: <input name="data" value="'.(isset($_REQUEST['data']) ? htmlspecialchars($_REQUEST['data']) : 'PHP QR Code :)').'" /> |
78 | 78 | ECC: <select name="level"> |
79 | - <option value="L"'.(($errorCorrectionLevel == 'L') ? ' selected' : '').'>L - smallest</option> |
|
80 | - <option value="M"'.(($errorCorrectionLevel == 'M') ? ' selected' : '').'>M</option> |
|
81 | - <option value="Q"'.(($errorCorrectionLevel == 'Q') ? ' selected' : '').'>Q</option> |
|
82 | - <option value="H"'.(($errorCorrectionLevel == 'H') ? ' selected' : '').'>H - best</option> |
|
79 | + <option value="L"'.(($errorCorrectionLevel=='L') ? ' selected' : '').'>L - smallest</option> |
|
80 | + <option value="M"'.(($errorCorrectionLevel=='M') ? ' selected' : '').'>M</option> |
|
81 | + <option value="Q"'.(($errorCorrectionLevel=='Q') ? ' selected' : '').'>Q</option> |
|
82 | + <option value="H"'.(($errorCorrectionLevel=='H') ? ' selected' : '').'>H - best</option> |
|
83 | 83 | </select> |
84 | 84 | Size: <select name="size">'; |
85 | 85 | |
86 | - for ($i = 1; $i <= 10; $i++) { |
|
87 | - echo '<option value="'.$i.'"'.(($matrixPointSize == $i) ? ' selected' : '').'>'.$i.'</option>'; |
|
86 | + for ($i = 1; $i<=10; $i++) { |
|
87 | + echo '<option value="'.$i.'"'.(($matrixPointSize==$i) ? ' selected' : '').'>'.$i.'</option>'; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | echo '</select> |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $this->blocks = QRspec::rsBlockNum($spec); |
78 | 78 | |
79 | 79 | $ret = $this->init($spec); |
80 | - if ($ret < 0) { |
|
80 | + if ($ret<0) { |
|
81 | 81 | throw new Exception('block alloc error'); |
82 | 82 | return; |
83 | 83 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $blockNo = 0; |
96 | 96 | $dataPos = 0; |
97 | 97 | $eccPos = 0; |
98 | - for ($i = 0; $i < QRspec::rsBlockNum1($spec); $i++) { |
|
98 | + for ($i = 0; $i<QRspec::rsBlockNum1($spec); $i++) { |
|
99 | 99 | $ecc = array_slice($this->ecccode, $eccPos); |
100 | 100 | $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs); |
101 | 101 | $this->ecccode = array_merge(array_slice($this->ecccode, 0, $eccPos), $ecc); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $blockNo++; |
106 | 106 | } |
107 | 107 | |
108 | - if (QRspec::rsBlockNum2($spec) == 0) { |
|
108 | + if (QRspec::rsBlockNum2($spec)==0) { |
|
109 | 109 | return 0; |
110 | 110 | } |
111 | 111 | |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | $el = QRspec::rsEccCodes2($spec); |
114 | 114 | $rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el); |
115 | 115 | |
116 | - if ($rs == null) { |
|
116 | + if ($rs==null) { |
|
117 | 117 | return -1; |
118 | 118 | } |
119 | 119 | |
120 | - for ($i = 0; $i < QRspec::rsBlockNum2($spec); $i++) { |
|
120 | + for ($i = 0; $i<QRspec::rsBlockNum2($spec); $i++) { |
|
121 | 121 | $ecc = array_slice($this->ecccode, $eccPos); |
122 | 122 | $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs); |
123 | 123 | $this->ecccode = array_merge(array_slice($this->ecccode, 0, $eccPos), $ecc); |
@@ -135,14 +135,14 @@ discard block |
||
135 | 135 | { |
136 | 136 | $ret; |
137 | 137 | |
138 | - if ($this->count < $this->dataLength) { |
|
138 | + if ($this->count<$this->dataLength) { |
|
139 | 139 | $row = $this->count % $this->blocks; |
140 | 140 | $col = $this->count / $this->blocks; |
141 | - if ($col >= $this->rsblocks[0]->dataLength) { |
|
141 | + if ($col>=$this->rsblocks[0]->dataLength) { |
|
142 | 142 | $row += $this->b1; |
143 | 143 | } |
144 | 144 | $ret = $this->rsblocks[$row]->data[$col]; |
145 | - } elseif ($this->count < $this->dataLength + $this->eccLength) { |
|
145 | + } elseif ($this->count<$this->dataLength + $this->eccLength) { |
|
146 | 146 | $row = ($this->count - $this->dataLength) % $this->blocks; |
147 | 147 | $col = ($this->count - $this->dataLength) / $this->blocks; |
148 | 148 | $ret = $this->rsblocks[$row]->ecc[$col]; |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | //---------------------------------------------------------------------- |
167 | 167 | public function encodeMask(QRinput $input, $mask) |
168 | 168 | { |
169 | - if ($input->getVersion() < 0 || $input->getVersion() > QRSPEC_VERSION_MAX) { |
|
169 | + if ($input->getVersion()<0 || $input->getVersion()>QRSPEC_VERSION_MAX) { |
|
170 | 170 | throw new Exception('wrong version'); |
171 | 171 | } |
172 | - if ($input->getErrorCorrectionLevel() > QR_ECLEVEL_H) { |
|
172 | + if ($input->getErrorCorrectionLevel()>QR_ECLEVEL_H) { |
|
173 | 173 | throw new Exception('wrong level'); |
174 | 174 | } |
175 | 175 | |
@@ -187,12 +187,12 @@ discard block |
||
187 | 187 | } |
188 | 188 | |
189 | 189 | // inteleaved data and ecc codes |
190 | - for ($i = 0; $i < $raw->dataLength + $raw->eccLength; $i++) { |
|
190 | + for ($i = 0; $i<$raw->dataLength + $raw->eccLength; $i++) { |
|
191 | 191 | $code = $raw->getCode(); |
192 | 192 | $bit = 0x80; |
193 | - for ($j = 0; $j < 8; $j++) { |
|
193 | + for ($j = 0; $j<8; $j++) { |
|
194 | 194 | $addr = $filler->next(); |
195 | - $filler->setFrameAt($addr, 0x02 | (($bit & $code) != 0)); |
|
195 | + $filler->setFrameAt($addr, 0x02 | (($bit & $code)!=0)); |
|
196 | 196 | $bit = $bit >> 1; |
197 | 197 | } |
198 | 198 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | |
204 | 204 | // remainder bits |
205 | 205 | $j = QRspec::getRemainder($version); |
206 | - for ($i = 0; $i < $j; $i++) { |
|
206 | + for ($i = 0; $i<$j; $i++) { |
|
207 | 207 | $addr = $filler->next(); |
208 | 208 | $filler->setFrameAt($addr, 0x02); |
209 | 209 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | |
214 | 214 | // masking |
215 | 215 | $maskObj = new QRmask(); |
216 | - if ($mask < 0) { |
|
216 | + if ($mask<0) { |
|
217 | 217 | if (QR_FIND_BEST_MASK) { |
218 | 218 | $masked = $maskObj->mask($width, $frame, $input->getErrorCorrectionLevel()); |
219 | 219 | } else { |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $masked = $maskObj->makeMask($width, $frame, $mask, $input->getErrorCorrectionLevel()); |
224 | 224 | } |
225 | 225 | |
226 | - if ($masked == null) { |
|
226 | + if ($masked==null) { |
|
227 | 227 | return; |
228 | 228 | } |
229 | 229 | |
@@ -245,18 +245,18 @@ discard block |
||
245 | 245 | //---------------------------------------------------------------------- |
246 | 246 | public function encodeString8bit($string, $version, $level) |
247 | 247 | { |
248 | - if (string == null) { |
|
248 | + if (string==null) { |
|
249 | 249 | throw new Exception('empty string!'); |
250 | 250 | return; |
251 | 251 | } |
252 | 252 | |
253 | 253 | $input = new QRinput($version, $level); |
254 | - if ($input == null) { |
|
254 | + if ($input==null) { |
|
255 | 255 | return; |
256 | 256 | } |
257 | 257 | |
258 | 258 | $ret = $input->append($input, QR_MODE_8, strlen($string), str_split($string)); |
259 | - if ($ret < 0) { |
|
259 | + if ($ret<0) { |
|
260 | 260 | unset($input); |
261 | 261 | |
262 | 262 | return; |
@@ -268,18 +268,18 @@ discard block |
||
268 | 268 | //---------------------------------------------------------------------- |
269 | 269 | public function encodeString($string, $version, $level, $hint, $casesensitive) |
270 | 270 | { |
271 | - if ($hint != QR_MODE_8 && $hint != QR_MODE_KANJI) { |
|
271 | + if ($hint!=QR_MODE_8 && $hint!=QR_MODE_KANJI) { |
|
272 | 272 | throw new Exception('bad hint'); |
273 | 273 | return; |
274 | 274 | } |
275 | 275 | |
276 | 276 | $input = new QRinput($version, $level); |
277 | - if ($input == null) { |
|
277 | + if ($input==null) { |
|
278 | 278 | return; |
279 | 279 | } |
280 | 280 | |
281 | 281 | $ret = QRsplit::splitStringToQRinput($string, $input, $hint, $casesensitive); |
282 | - if ($ret < 0) { |
|
282 | + if ($ret<0) { |
|
283 | 283 | return; |
284 | 284 | } |
285 | 285 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | public function next() |
366 | 366 | { |
367 | 367 | do { |
368 | - if ($this->bit == -1) { |
|
368 | + if ($this->bit==-1) { |
|
369 | 369 | $this->bit = 0; |
370 | 370 | |
371 | 371 | return ['x'=>$this->x, 'y'=>$this->y]; |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | $y = $this->y; |
376 | 376 | $w = $this->width; |
377 | 377 | |
378 | - if ($this->bit == 0) { |
|
378 | + if ($this->bit==0) { |
|
379 | 379 | $x--; |
380 | 380 | $this->bit++; |
381 | 381 | } else { |
@@ -384,28 +384,28 @@ discard block |
||
384 | 384 | $this->bit--; |
385 | 385 | } |
386 | 386 | |
387 | - if ($this->dir < 0) { |
|
388 | - if ($y < 0) { |
|
387 | + if ($this->dir<0) { |
|
388 | + if ($y<0) { |
|
389 | 389 | $y = 0; |
390 | 390 | $x -= 2; |
391 | 391 | $this->dir = 1; |
392 | - if ($x == 6) { |
|
392 | + if ($x==6) { |
|
393 | 393 | $x--; |
394 | 394 | $y = 9; |
395 | 395 | } |
396 | 396 | } |
397 | 397 | } else { |
398 | - if ($y == $w) { |
|
398 | + if ($y==$w) { |
|
399 | 399 | $y = $w - 1; |
400 | 400 | $x -= 2; |
401 | 401 | $this->dir = -1; |
402 | - if ($x == 6) { |
|
402 | + if ($x==6) { |
|
403 | 403 | $x--; |
404 | 404 | $y -= 8; |
405 | 405 | } |
406 | 406 | } |
407 | 407 | } |
408 | - if ($x < 0 || $y < 0) { |
|
408 | + if ($x<0 || $y<0) { |
|
409 | 409 | return; |
410 | 410 | } |
411 | 411 | |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | |
501 | 501 | QRtools::markTime('after_encode'); |
502 | 502 | |
503 | - if ($outfile !== false) { |
|
503 | + if ($outfile!==false) { |
|
504 | 504 | file_put_contents($outfile, implode("\n", QRtools::binarize($code->data))); |
505 | 505 | } else { |
506 | 506 | return QRtools::binarize($code->data); |
@@ -516,11 +516,11 @@ discard block |
||
516 | 516 | $err = ob_get_contents(); |
517 | 517 | ob_end_clean(); |
518 | 518 | |
519 | - if ($err != '') { |
|
519 | + if ($err!='') { |
|
520 | 520 | QRtools::log($outfile, $err); |
521 | 521 | } |
522 | 522 | |
523 | - $maxSize = (int) (QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin)); |
|
523 | + $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin)); |
|
524 | 524 | |
525 | 525 | QRimage::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin, $saveandprint, $this->back_color, $this->fore_color); |
526 | 526 | } catch (Exception $e) { |
@@ -537,11 +537,11 @@ discard block |
||
537 | 537 | $err = ob_get_contents(); |
538 | 538 | ob_end_clean(); |
539 | 539 | |
540 | - if ($err != '') { |
|
540 | + if ($err!='') { |
|
541 | 541 | QRtools::log($outfile, $err); |
542 | 542 | } |
543 | 543 | |
544 | - $maxSize = (int) (QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin)); |
|
544 | + $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin)); |
|
545 | 545 | |
546 | 546 | QRvect::eps($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin, $saveandprint, $this->back_color, $this->fore_color, $this->cmyk); |
547 | 547 | } catch (Exception $e) { |
@@ -558,11 +558,11 @@ discard block |
||
558 | 558 | $err = ob_get_contents(); |
559 | 559 | ob_end_clean(); |
560 | 560 | |
561 | - if ($err != '') { |
|
561 | + if ($err!='') { |
|
562 | 562 | QRtools::log($outfile, $err); |
563 | 563 | } |
564 | 564 | |
565 | - $maxSize = (int) (QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin)); |
|
565 | + $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin)); |
|
566 | 566 | |
567 | 567 | QRvect::svg($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin, $saveandprint, $this->back_color, $this->fore_color); |
568 | 568 | } catch (Exception $e) { |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | { |
32 | 32 | $image = self::image($frame, $pixelPerPoint, $outerFrame, $back_color, $fore_color); |
33 | 33 | |
34 | - if ($filename === false) { |
|
34 | + if ($filename===false) { |
|
35 | 35 | header('Content-type: image/png'); |
36 | 36 | imagepng($image); |
37 | 37 | } else { |
38 | - if ($saveandprint === true) { |
|
38 | + if ($saveandprint===true) { |
|
39 | 39 | imagepng($image, $filename); |
40 | 40 | header('Content-type: image/png'); |
41 | 41 | imagepng($image); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | { |
53 | 53 | $image = self::image($frame, $pixelPerPoint, $outerFrame); |
54 | 54 | |
55 | - if ($filename === false) { |
|
55 | + if ($filename===false) { |
|
56 | 56 | header('Content-type: image/jpeg'); |
57 | 57 | imagejpeg($image, null, $q); |
58 | 58 | } else { |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | |
89 | 89 | imagefill($base_image, 0, 0, $col[0]); |
90 | 90 | |
91 | - for ($y = 0; $y < $h; $y++) { |
|
92 | - for ($x = 0; $x < $w; $x++) { |
|
93 | - if ($frame[$y][$x] == '1') { |
|
91 | + for ($y = 0; $y<$h; $y++) { |
|
92 | + for ($x = 0; $x<$w; $x++) { |
|
93 | + if ($frame[$y][$x]=='1') { |
|
94 | 94 | imagesetpixel($base_image, $x + $outerFrame, $y + $outerFrame, $col[1]); |
95 | 95 | } |
96 | 96 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $bstream->allocate($bits); |
51 | 51 | |
52 | 52 | $mask = 1 << ($bits - 1); |
53 | - for ($i = 0; $i < $bits; $i++) { |
|
53 | + for ($i = 0; $i<$bits; $i++) { |
|
54 | 54 | if ($num & $mask) { |
55 | 55 | $bstream->data[$i] = 1; |
56 | 56 | } else { |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | $bstream->allocate($size * 8); |
70 | 70 | $p = 0; |
71 | 71 | |
72 | - for ($i = 0; $i < $size; $i++) { |
|
72 | + for ($i = 0; $i<$size; $i++) { |
|
73 | 73 | $mask = 0x80; |
74 | - for ($j = 0; $j < 8; $j++) { |
|
74 | + for ($j = 0; $j<8; $j++) { |
|
75 | 75 | if ($data[$i] & $mask) { |
76 | 76 | $bstream->data[$p] = 1; |
77 | 77 | } else { |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | return -1; |
93 | 93 | } |
94 | 94 | |
95 | - if ($arg->size() == 0) { |
|
95 | + if ($arg->size()==0) { |
|
96 | 96 | return 0; |
97 | 97 | } |
98 | 98 | |
99 | - if ($this->size() == 0) { |
|
99 | + if ($this->size()==0) { |
|
100 | 100 | $this->data = $arg->data; |
101 | 101 | |
102 | 102 | return 0; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | //---------------------------------------------------------------------- |
111 | 111 | public function appendNum($bits, $num) |
112 | 112 | { |
113 | - if ($bits == 0) { |
|
113 | + if ($bits==0) { |
|
114 | 114 | return 0; |
115 | 115 | } |
116 | 116 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | //---------------------------------------------------------------------- |
130 | 130 | public function appendBytes($size, $data) |
131 | 131 | { |
132 | - if ($size == 0) { |
|
132 | + if ($size==0) { |
|
133 | 133 | return 0; |
134 | 134 | } |
135 | 135 | |
@@ -150,18 +150,18 @@ discard block |
||
150 | 150 | { |
151 | 151 | $size = $this->size(); |
152 | 152 | |
153 | - if ($size == 0) { |
|
153 | + if ($size==0) { |
|
154 | 154 | return []; |
155 | 155 | } |
156 | 156 | |
157 | - $data = array_fill(0, (int) (($size + 7) / 8), 0); |
|
158 | - $bytes = (int) ($size / 8); |
|
157 | + $data = array_fill(0, (int)(($size + 7) / 8), 0); |
|
158 | + $bytes = (int)($size / 8); |
|
159 | 159 | |
160 | 160 | $p = 0; |
161 | 161 | |
162 | - for ($i = 0; $i < $bytes; $i++) { |
|
162 | + for ($i = 0; $i<$bytes; $i++) { |
|
163 | 163 | $v = 0; |
164 | - for ($j = 0; $j < 8; $j++) { |
|
164 | + for ($j = 0; $j<8; $j++) { |
|
165 | 165 | $v = $v << 1; |
166 | 166 | $v |= $this->data[$p]; |
167 | 167 | $p++; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | if ($size & 7) { |
173 | 173 | $v = 0; |
174 | - for ($j = 0; $j < ($size & 7); $j++) { |
|
174 | + for ($j = 0; $j<($size & 7); $j++) { |
|
175 | 175 | $v = $v << 1; |
176 | 176 | $v |= $this->data[$p]; |
177 | 177 | $p++; |
@@ -5,12 +5,12 @@ |
||
5 | 5 | * Config file, feel free to modify |
6 | 6 | */ |
7 | 7 | |
8 | - define('QR_CACHEABLE', true); // use cache - more disk reads but less CPU power, masks and format templates are stored there |
|
9 | - define('QR_CACHE_DIR', dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR); // used when QR_CACHEABLE === true |
|
10 | - define('QR_LOG_DIR', dirname(__FILE__).DIRECTORY_SEPARATOR); // default error logs dir |
|
8 | + define('QR_CACHEABLE', true); // use cache - more disk reads but less CPU power, masks and format templates are stored there |
|
9 | + define('QR_CACHE_DIR', dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR); // used when QR_CACHEABLE === true |
|
10 | + define('QR_LOG_DIR', dirname(__FILE__).DIRECTORY_SEPARATOR); // default error logs dir |
|
11 | 11 | |
12 | - define('QR_FIND_BEST_MASK', true); // if true, estimates best mask (spec. default, but extremally slow; set to false to significant performance boost but (propably) worst quality code |
|
13 | - define('QR_FIND_FROM_RANDOM', false); // if false, checks all masks available, otherwise value tells count of masks need to be checked, mask id are got randomly |
|
14 | - define('QR_DEFAULT_MASK', 2); // when QR_FIND_BEST_MASK === false |
|
12 | + define('QR_FIND_BEST_MASK', true); // if true, estimates best mask (spec. default, but extremally slow; set to false to significant performance boost but (propably) worst quality code |
|
13 | + define('QR_FIND_FROM_RANDOM', false); // if false, checks all masks available, otherwise value tells count of masks need to be checked, mask id are got randomly |
|
14 | + define('QR_DEFAULT_MASK', 2); // when QR_FIND_BEST_MASK === false |
|
15 | 15 | |
16 | - define('QR_PNG_MAXIMUM_SIZE', 1024); // maximum allowed png image width (in pixels), tune to make sure GD and PHP can handle such big images |
|
16 | + define('QR_PNG_MAXIMUM_SIZE', 1024); // maximum allowed png image width (in pixels), tune to make sure GD and PHP can handle such big images |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $blacks = 0; |
47 | 47 | $format = QRspec::getFormatInfo($mask, $level); |
48 | 48 | |
49 | - for ($i = 0; $i < 8; $i++) { |
|
49 | + for ($i = 0; $i<8; $i++) { |
|
50 | 50 | if ($format & 1) { |
51 | 51 | $blacks += 2; |
52 | 52 | $v = 0x85; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | $frame[8][$width - 1 - $i] = chr($v); |
58 | - if ($i < 6) { |
|
58 | + if ($i<6) { |
|
59 | 59 | $frame[$i][8] = chr($v); |
60 | 60 | } else { |
61 | 61 | $frame[$i + 1][8] = chr($v); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $format = $format >> 1; |
64 | 64 | } |
65 | 65 | |
66 | - for ($i = 0; $i < 7; $i++) { |
|
66 | + for ($i = 0; $i<7; $i++) { |
|
67 | 67 | if ($format & 1) { |
68 | 68 | $blacks += 2; |
69 | 69 | $v = 0x85; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | $frame[$width - 7 + $i][8] = chr($v); |
75 | - if ($i == 0) { |
|
75 | + if ($i==0) { |
|
76 | 76 | $frame[8][7] = chr($v); |
77 | 77 | } else { |
78 | 78 | $frame[8][6 - $i] = chr($v); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | public function mask4($x, $y) |
109 | 109 | { |
110 | - return (((int) ($y / 2)) + ((int) ($x / 3))) & 1; |
|
110 | + return (((int)($y / 2)) + ((int)($x / 3))) & 1; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | public function mask5($x, $y) |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | { |
131 | 131 | $bitMask = array_fill(0, $width, array_fill(0, $width, 0)); |
132 | 132 | |
133 | - for ($y = 0; $y < $width; $y++) { |
|
134 | - for ($x = 0; $x < $width; $x++) { |
|
133 | + for ($y = 0; $y<$width; $y++) { |
|
134 | + for ($x = 0; $x<$width; $x++) { |
|
135 | 135 | if (ord($frame[$y][$x]) & 0x80) { |
136 | 136 | $bitMask[$y][$x] = 0; |
137 | 137 | } else { |
138 | 138 | $maskFunc = call_user_func([$this, 'mask'.$maskNo], $x, $y); |
139 | - $bitMask[$y][$x] = ($maskFunc == 0) ? 1 : 0; |
|
139 | + $bitMask[$y][$x] = ($maskFunc==0) ? 1 : 0; |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | } |
@@ -197,12 +197,12 @@ discard block |
||
197 | 197 | |
198 | 198 | $d = $s; |
199 | 199 | |
200 | - for ($y = 0; $y < $width; $y++) { |
|
201 | - for ($x = 0; $x < $width; $x++) { |
|
202 | - if ($bitMask[$y][$x] == 1) { |
|
203 | - $d[$y][$x] = chr(ord($s[$y][$x]) ^ (int) $bitMask[$y][$x]); |
|
200 | + for ($y = 0; $y<$width; $y++) { |
|
201 | + for ($x = 0; $x<$width; $x++) { |
|
202 | + if ($bitMask[$y][$x]==1) { |
|
203 | + $d[$y][$x] = chr(ord($s[$y][$x]) ^ (int)$bitMask[$y][$x]); |
|
204 | 204 | } |
205 | - $b += (int) (ord($d[$y][$x]) & 1); |
|
205 | + $b += (int)(ord($d[$y][$x]) & 1); |
|
206 | 206 | } |
207 | 207 | } |
208 | 208 | |
@@ -224,20 +224,20 @@ discard block |
||
224 | 224 | { |
225 | 225 | $demerit = 0; |
226 | 226 | |
227 | - for ($i = 0; $i < $length; $i++) { |
|
228 | - if ($this->runLength[$i] >= 5) { |
|
227 | + for ($i = 0; $i<$length; $i++) { |
|
228 | + if ($this->runLength[$i]>=5) { |
|
229 | 229 | $demerit += (N1 + ($this->runLength[$i] - 5)); |
230 | 230 | } |
231 | 231 | if ($i & 1) { |
232 | - if (($i >= 3) && ($i < ($length - 2)) && ($this->runLength[$i] % 3 == 0)) { |
|
233 | - $fact = (int) ($this->runLength[$i] / 3); |
|
234 | - if (($this->runLength[$i - 2] == $fact) && |
|
235 | - ($this->runLength[$i - 1] == $fact) && |
|
236 | - ($this->runLength[$i + 1] == $fact) && |
|
237 | - ($this->runLength[$i + 2] == $fact)) { |
|
238 | - if (($this->runLength[$i - 3] < 0) || ($this->runLength[$i - 3] >= (4 * $fact))) { |
|
232 | + if (($i>=3) && ($i<($length - 2)) && ($this->runLength[$i] % 3==0)) { |
|
233 | + $fact = (int)($this->runLength[$i] / 3); |
|
234 | + if (($this->runLength[$i - 2]==$fact) && |
|
235 | + ($this->runLength[$i - 1]==$fact) && |
|
236 | + ($this->runLength[$i + 1]==$fact) && |
|
237 | + ($this->runLength[$i + 2]==$fact)) { |
|
238 | + if (($this->runLength[$i - 3]<0) || ($this->runLength[$i - 3]>=(4 * $fact))) { |
|
239 | 239 | $demerit += N3; |
240 | - } elseif ((($i + 3) >= $length) || ($this->runLength[$i + 3] >= (4 * $fact))) { |
|
240 | + } elseif ((($i + 3)>=$length) || ($this->runLength[$i + 3]>=(4 * $fact))) { |
|
241 | 241 | $demerit += N3; |
242 | 242 | } |
243 | 243 | } |
@@ -254,18 +254,18 @@ discard block |
||
254 | 254 | $head = 0; |
255 | 255 | $demerit = 0; |
256 | 256 | |
257 | - for ($y = 0; $y < $width; $y++) { |
|
257 | + for ($y = 0; $y<$width; $y++) { |
|
258 | 258 | $head = 0; |
259 | 259 | $this->runLength[0] = 1; |
260 | 260 | |
261 | 261 | $frameY = $frame[$y]; |
262 | 262 | |
263 | - if ($y > 0) { |
|
263 | + if ($y>0) { |
|
264 | 264 | $frameYM = $frame[$y - 1]; |
265 | 265 | } |
266 | 266 | |
267 | - for ($x = 0; $x < $width; $x++) { |
|
268 | - if (($x > 0) && ($y > 0)) { |
|
267 | + for ($x = 0; $x<$width; $x++) { |
|
268 | + if (($x>0) && ($y>0)) { |
|
269 | 269 | $b22 = ord($frameY[$x]) & ord($frameY[$x - 1]) & ord($frameYM[$x]) & ord($frameYM[$x - 1]); |
270 | 270 | $w22 = ord($frameY[$x]) | ord($frameY[$x - 1]) | ord($frameYM[$x]) | ord($frameYM[$x - 1]); |
271 | 271 | |
@@ -273,11 +273,11 @@ discard block |
||
273 | 273 | $demerit += N2; |
274 | 274 | } |
275 | 275 | } |
276 | - if (($x == 0) && (ord($frameY[$x]) & 1)) { |
|
276 | + if (($x==0) && (ord($frameY[$x]) & 1)) { |
|
277 | 277 | $this->runLength[0] = -1; |
278 | 278 | $head = 1; |
279 | 279 | $this->runLength[$head] = 1; |
280 | - } elseif ($x > 0) { |
|
280 | + } elseif ($x>0) { |
|
281 | 281 | if ((ord($frameY[$x]) ^ ord($frameY[$x - 1])) & 1) { |
282 | 282 | $head++; |
283 | 283 | $this->runLength[$head] = 1; |
@@ -290,16 +290,16 @@ discard block |
||
290 | 290 | $demerit += $this->calcN1N3($head + 1); |
291 | 291 | } |
292 | 292 | |
293 | - for ($x = 0; $x < $width; $x++) { |
|
293 | + for ($x = 0; $x<$width; $x++) { |
|
294 | 294 | $head = 0; |
295 | 295 | $this->runLength[0] = 1; |
296 | 296 | |
297 | - for ($y = 0; $y < $width; $y++) { |
|
298 | - if ($y == 0 && (ord($frame[$y][$x]) & 1)) { |
|
297 | + for ($y = 0; $y<$width; $y++) { |
|
298 | + if ($y==0 && (ord($frame[$y][$x]) & 1)) { |
|
299 | 299 | $this->runLength[0] = -1; |
300 | 300 | $head = 1; |
301 | 301 | $this->runLength[$head] = 1; |
302 | - } elseif ($y > 0) { |
|
302 | + } elseif ($y>0) { |
|
303 | 303 | if ((ord($frame[$y][$x]) ^ ord($frame[$y - 1][$x])) & 1) { |
304 | 304 | $head++; |
305 | 305 | $this->runLength[$head] = 1; |
@@ -324,9 +324,9 @@ discard block |
||
324 | 324 | |
325 | 325 | $checked_masks = [0, 1, 2, 3, 4, 5, 6, 7]; |
326 | 326 | |
327 | - if (QR_FIND_FROM_RANDOM !== false) { |
|
327 | + if (QR_FIND_FROM_RANDOM!==false) { |
|
328 | 328 | $howManuOut = 8 - (QR_FIND_FROM_RANDOM % 9); |
329 | - for ($i = 0; $i < $howManuOut; $i++) { |
|
329 | + for ($i = 0; $i<$howManuOut; $i++) { |
|
330 | 330 | $remPos = rand(0, count($checked_masks) - 1); |
331 | 331 | unset($checked_masks[$remPos]); |
332 | 332 | $checked_masks = array_values($checked_masks); |
@@ -342,11 +342,11 @@ discard block |
||
342 | 342 | $blacks = 0; |
343 | 343 | $blacks = $this->makeMaskNo($i, $width, $frame, $mask); |
344 | 344 | $blacks += $this->writeFormatInformation($width, $mask, $i, $level); |
345 | - $blacks = (int) (100 * $blacks / ($width * $width)); |
|
346 | - $demerit = (int) ((int) (abs($blacks - 50) / 5) * N4); |
|
345 | + $blacks = (int)(100 * $blacks / ($width * $width)); |
|
346 | + $demerit = (int)((int)(abs($blacks - 50) / 5) * N4); |
|
347 | 347 | $demerit += $this->evaluateSymbol($width, $mask); |
348 | 348 | |
349 | - if ($demerit < $minDemerit) { |
|
349 | + if ($demerit<$minDemerit) { |
|
350 | 350 | $minDemerit = $demerit; |
351 | 351 | $bestMask = $mask; |
352 | 352 | $bestMaskNum = $i; |