@@ -70,7 +70,7 @@ |
||
70 | 70 | * @return string|\Imagick |
71 | 71 | */ |
72 | 72 | public function dump(string $file = null){ |
73 | - $file ??= $this->options->cachefile; |
|
73 | + $file ??= $this->options->cachefile; |
|
74 | 74 | $this->imagick = new Imagick; |
75 | 75 | |
76 | 76 | $this->imagick->newImage( |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @inheritDoc |
48 | 48 | */ |
49 | 49 | public function dump(string $file = null){ |
50 | - $file ??= $this->options->cachefile; |
|
50 | + $file ??= $this->options->cachefile; |
|
51 | 51 | $saveToFile = $file !== null; |
52 | 52 | |
53 | 53 | switch($this->options->outputType){ |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | $cssClass = implode(' ', [ |
189 | 189 | 'qr-'.$M_TYPE, |
190 | - ($M_TYPE & QRMatrix::IS_DARK) === QRMatrix::IS_DARK ? 'dark' : 'light', |
|
190 | + ($M_TYPE&QRMatrix::IS_DARK) === QRMatrix::IS_DARK ? 'dark' : 'light', |
|
191 | 191 | $this->options->cssClass, |
192 | 192 | ]); |
193 | 193 |
@@ -129,7 +129,7 @@ |
||
129 | 129 | |
130 | 130 | // scale down to the expected size |
131 | 131 | if($this->options->drawCircularModules && $this->options->scale <= 20){ |
132 | - $this->image = imagescale($this->image, $this->length/10, $this->length/10, IMG_BICUBIC); |
|
132 | + $this->image = imagescale($this->image, $this->length / 10, $this->length / 10, IMG_BICUBIC); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | if($this->options->returnResource){ |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | while($i + 1 < $len){ |
65 | - $c = ((0xff & ord($string[$i])) << 8) | (0xff & ord($string[$i + 1])); |
|
65 | + $c = ((0xff&ord($string[$i])) << 8)|(0xff&ord($string[$i + 1])); |
|
66 | 66 | |
67 | 67 | if(!($c >= 0x8140 && $c <= 0x9ffc) && !($c >= 0xe040 && $c <= 0xebbf)){ |
68 | 68 | return false; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $len = strlen($this->data); |
90 | 90 | |
91 | 91 | for($i = 0; $i + 1 < $len; $i += 2){ |
92 | - $c = ((0xff & ord($this->data[$i])) << 8) | (0xff & ord($this->data[$i + 1])); |
|
92 | + $c = ((0xff&ord($this->data[$i])) << 8)|(0xff&ord($this->data[$i + 1])); |
|
93 | 93 | |
94 | 94 | if($c >= 0x8140 && $c <= 0x9ffC){ |
95 | 95 | $c -= 0x8140; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | throw new QRCodeDataException(sprintf('illegal char at %d [%d]', $i + 1, $c)); |
102 | 102 | } |
103 | 103 | |
104 | - $bitBuffer->put(((($c >> 8) & 0xff) * 0xc0) + ($c & 0xff), 13); |
|
104 | + $bitBuffer->put(((($c >> 8)&0xff) * 0xc0) + ($c&0xff), 13); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | if($i < $len){ |
@@ -128,15 +128,15 @@ discard block |
||
128 | 128 | while($length > 0){ |
129 | 129 | // Each 13 bits encodes a 2-byte character |
130 | 130 | $twoBytes = $bitBuffer->read(13); |
131 | - $assembledTwoBytes = ((int)($twoBytes / 0x0c0) << 8) | ($twoBytes % 0x0c0); |
|
131 | + $assembledTwoBytes = ((int)($twoBytes / 0x0c0) << 8)|($twoBytes % 0x0c0); |
|
132 | 132 | |
133 | 133 | $assembledTwoBytes += ($assembledTwoBytes < 0x01f00) |
134 | 134 | ? 0x08140 // In the 0x8140 to 0x9FFC range |
135 | 135 | : 0x0c140; // In the 0xE040 to 0xEBBF range |
136 | 136 | |
137 | - $buffer[$offset] = chr(0xff & ($assembledTwoBytes >> 8)); |
|
138 | - $buffer[$offset + 1] = chr(0xff & $assembledTwoBytes); |
|
139 | - $offset += 2; |
|
137 | + $buffer[$offset] = chr(0xff&($assembledTwoBytes >> 8)); |
|
138 | + $buffer[$offset + 1] = chr(0xff&$assembledTwoBytes); |
|
139 | + $offset += 2; |
|
140 | 140 | $length--; |
141 | 141 | } |
142 | 142 |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | // This class uses 5x5 blocks to compute local luminance, where each block is 8x8 pixels. |
36 | 36 | // So this is the smallest dimension in each axis we can accept. |
37 | 37 | private const BLOCK_SIZE_POWER = 3; |
38 | - private const BLOCK_SIZE = 8; // ...0100...00 |
|
39 | - private const BLOCK_SIZE_MASK = 7; // ...0011...11 |
|
38 | + private const BLOCK_SIZE = 8; // ...0100...00 |
|
39 | + private const BLOCK_SIZE_MASK = 7; // ...0011...11 |
|
40 | 40 | private const MINIMUM_DIMENSION = 40; |
41 | 41 | private const MIN_DYNAMIC_RANGE = 24; |
42 | 42 | |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | if($width >= self::MINIMUM_DIMENSION && $height >= self::MINIMUM_DIMENSION){ |
140 | 140 | $subWidth = $width >> self::BLOCK_SIZE_POWER; |
141 | 141 | |
142 | - if(($width & self::BLOCK_SIZE_MASK) !== 0){ |
|
142 | + if(($width&self::BLOCK_SIZE_MASK) !== 0){ |
|
143 | 143 | $subWidth++; |
144 | 144 | } |
145 | 145 | |
146 | 146 | $subHeight = $height >> self::BLOCK_SIZE_POWER; |
147 | 147 | |
148 | - if(($height & self::BLOCK_SIZE_MASK) !== 0){ |
|
148 | + if(($height&self::BLOCK_SIZE_MASK) !== 0){ |
|
149 | 149 | $subHeight++; |
150 | 150 | } |
151 | 151 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $right = (int)(($width * 4) / 5); |
173 | 173 | |
174 | 174 | for($x = (int)($width / 5); $x < $right; $x++){ |
175 | - $pixel = $localLuminances[(int)$x] & 0xff; |
|
175 | + $pixel = $localLuminances[(int)$x]&0xff; |
|
176 | 176 | $buckets[$pixel >> self::LUMINANCE_SHIFT]++; |
177 | 177 | } |
178 | 178 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $offset = $y * $width; |
189 | 189 | |
190 | 190 | for($x = 0; $x < $width; $x++){ |
191 | - $pixel = (int)($localLuminances[$offset + $x] & 0xff); |
|
191 | + $pixel = (int)($localLuminances[$offset + $x]&0xff); |
|
192 | 192 | |
193 | 193 | if($pixel < $blackPoint){ |
194 | 194 | $matrix->set($x, $y); |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | for($yy = 0, $offset = $yoffset * $width + $xoffset; $yy < self::BLOCK_SIZE; $yy++, $offset += $width){ |
236 | 236 | |
237 | 237 | for($xx = 0; $xx < self::BLOCK_SIZE; $xx++){ |
238 | - $pixel = (int)($luminances[(int)($offset + $xx)]) & 0xff; |
|
239 | - $sum += $pixel; |
|
238 | + $pixel = (int)($luminances[(int)($offset + $xx)])&0xff; |
|
239 | + $sum += $pixel; |
|
240 | 240 | // still looking for good contrast |
241 | 241 | if($pixel < $min){ |
242 | 242 | $min = $pixel; |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | // finish the rest of the rows quickly |
253 | 253 | for($yy++, $offset += $width; $yy < self::BLOCK_SIZE; $yy++, $offset += $width){ |
254 | 254 | for($xx = 0; $xx < self::BLOCK_SIZE; $xx++){ |
255 | - $sum += (int)($luminances[(int)($offset + $xx)]) & 0xff; |
|
255 | + $sum += (int)($luminances[(int)($offset + $xx)])&0xff; |
|
256 | 256 | } |
257 | 257 | } |
258 | 258 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | |
331 | 331 | for($z = -2; $z <= 2; $z++){ |
332 | 332 | $blackRow = $blackPoints[$top + $z]; |
333 | - $sum += $blackRow[$left - 2] + $blackRow[$left - 1] + $blackRow[$left] + $blackRow[$left + 1] + $blackRow[$left + 2]; |
|
333 | + $sum += $blackRow[$left - 2] + $blackRow[$left - 1] + $blackRow[$left] + $blackRow[$left + 1] + $blackRow[$left + 2]; |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | $average = (int)($sum / 25); |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | for($j = 0, $o = $yoffset * $width + $xoffset; $j < self::BLOCK_SIZE; $j++, $o += $width){ |
340 | 340 | for($i = 0; $i < self::BLOCK_SIZE; $i++){ |
341 | 341 | // Comparison needs to be <= so that black == 0 pixels are black even if the threshold is 0. |
342 | - if(((int)($luminances[$o + $i]) & 0xff) <= $average){ |
|
342 | + if(((int)($luminances[$o + $i])&0xff) <= $average){ |
|
343 | 343 | $matrix->set($xoffset + $i, $yoffset + $j); |
344 | 344 | } |
345 | 345 | } |