@@ -25,16 +25,16 @@ discard block |
||
| 25 | 25 | ]; |
| 26 | 26 | |
| 27 | 27 | const MAX_BITS = [ |
| 28 | - QRCode::TYPE_01 => [ 128, 152, 72, 104], |
|
| 29 | - QRCode::TYPE_02 => [ 224, 272, 128, 176], |
|
| 30 | - QRCode::TYPE_03 => [ 352, 440, 208, 272], |
|
| 31 | - QRCode::TYPE_04 => [ 512, 640, 288, 384], |
|
| 32 | - QRCode::TYPE_05 => [ 688, 864, 368, 496], |
|
| 33 | - QRCode::TYPE_06 => [ 864, 1088, 480, 608], |
|
| 34 | - QRCode::TYPE_07 => [ 992, 1248, 528, 704], |
|
| 35 | - QRCode::TYPE_08 => [1232, 1552, 688, 880], |
|
| 36 | - QRCode::TYPE_09 => [1456, 1856, 800, 1056], |
|
| 37 | - QRCode::TYPE_10 => [1728, 2192, 976, 1232], |
|
| 28 | + QRCode::TYPE_01 => [128, 152, 72, 104], |
|
| 29 | + QRCode::TYPE_02 => [224, 272, 128, 176], |
|
| 30 | + QRCode::TYPE_03 => [352, 440, 208, 272], |
|
| 31 | + QRCode::TYPE_04 => [512, 640, 288, 384], |
|
| 32 | + QRCode::TYPE_05 => [688, 864, 368, 496], |
|
| 33 | + QRCode::TYPE_06 => [864, 1088, 480, 608], |
|
| 34 | + QRCode::TYPE_07 => [992, 1248, 528, 704], |
|
| 35 | + QRCode::TYPE_08 => [1232, 1552, 688, 880], |
|
| 36 | + QRCode::TYPE_09 => [1456, 1856, 800, 1056], |
|
| 37 | + QRCode::TYPE_10 => [1728, 2192, 976, 1232], |
|
| 38 | 38 | ]; |
| 39 | 39 | |
| 40 | 40 | const MODE_NUMBER = 1 << 0; |
@@ -66,16 +66,16 @@ discard block |
||
| 66 | 66 | const PAD1 = 0x11; |
| 67 | 67 | |
| 68 | 68 | const MAX_LENGTH = [ |
| 69 | - [[ 41, 25, 17, 10], [ 34, 20, 14, 8], [ 27, 16, 11, 7], [ 17, 10, 7, 4]], |
|
| 70 | - [[ 77, 47, 32, 20], [ 63, 38, 26, 16], [ 48, 29, 20, 12], [ 34, 20, 14, 8]], |
|
| 71 | - [[127, 77, 53, 32], [101, 61, 42, 26], [ 77, 47, 32, 20], [ 58, 35, 24, 15]], |
|
| 72 | - [[187, 114, 78, 48], [149, 90, 62, 38], [111, 67, 46, 28], [ 82, 50, 34, 21]], |
|
| 73 | - [[255, 154, 106, 65], [202, 122, 84, 52], [144, 87, 60, 37], [106, 64, 44, 27]], |
|
| 74 | - [[322, 195, 134, 82], [255, 154, 106, 65], [178, 108, 74, 45], [139, 84, 58, 36]], |
|
| 75 | - [[370, 224, 154, 95], [293, 178, 122, 75], [207, 125, 86, 53], [154, 93, 64, 39]], |
|
| 76 | - [[461, 279, 192, 118], [365, 221, 152, 93], [259, 157, 108, 66], [202, 122, 84, 52]], |
|
| 77 | - [[552, 335, 230, 141], [432, 262, 180, 111], [312, 189, 130, 80], [235, 143, 98, 60]], |
|
| 78 | - [[652, 395, 271, 167], [513, 311, 213, 131], [364, 221, 151, 93], [288, 174, 119, 74]], |
|
| 69 | + [[41, 25, 17, 10], [34, 20, 14, 8], [27, 16, 11, 7], [17, 10, 7, 4]], |
|
| 70 | + [[77, 47, 32, 20], [63, 38, 26, 16], [48, 29, 20, 12], [34, 20, 14, 8]], |
|
| 71 | + [[127, 77, 53, 32], [101, 61, 42, 26], [77, 47, 32, 20], [58, 35, 24, 15]], |
|
| 72 | + [[187, 114, 78, 48], [149, 90, 62, 38], [111, 67, 46, 28], [82, 50, 34, 21]], |
|
| 73 | + [[255, 154, 106, 65], [202, 122, 84, 52], [144, 87, 60, 37], [106, 64, 44, 27]], |
|
| 74 | + [[322, 195, 134, 82], [255, 154, 106, 65], [178, 108, 74, 45], [139, 84, 58, 36]], |
|
| 75 | + [[370, 224, 154, 95], [293, 178, 122, 75], [207, 125, 86, 53], [154, 93, 64, 39]], |
|
| 76 | + [[461, 279, 192, 118], [365, 221, 152, 93], [259, 157, 108, 66], [202, 122, 84, 52]], |
|
| 77 | + [[552, 335, 230, 141], [432, 262, 180, 111], [312, 189, 130, 80], [235, 143, 98, 60]], |
|
| 78 | + [[652, 395, 271, 167], [513, 311, 213, 131], [364, 221, 151, 93], [288, 174, 119, 74]], |
|
| 79 | 79 | ]; |
| 80 | 80 | |
| 81 | 81 | const BLOCK_TABLE = [ |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | [1, 26, 19], // L |
| 84 | 84 | [1, 26, 16], // M |
| 85 | 85 | [1, 26, 13], // Q |
| 86 | - [1, 26, 9], // H |
|
| 86 | + [1, 26, 9], // H |
|
| 87 | 87 | // 2 |
| 88 | 88 | [1, 44, 34], |
| 89 | 89 | [1, 44, 28], |
@@ -96,14 +96,14 @@ discard block |
||
| 96 | 96 | [2, 35, 13], |
| 97 | 97 | // 4 |
| 98 | 98 | [1, 100, 80], |
| 99 | - [2, 50, 32], |
|
| 100 | - [2, 50, 24], |
|
| 101 | - [4, 25, 9], |
|
| 99 | + [2, 50, 32], |
|
| 100 | + [2, 50, 24], |
|
| 101 | + [4, 25, 9], |
|
| 102 | 102 | // 5 |
| 103 | 103 | [1, 134, 108], |
| 104 | - [2, 67, 43], |
|
| 105 | - [2, 33, 15, 2, 34, 16], |
|
| 106 | - [2, 33, 11, 2, 34, 12], |
|
| 104 | + [2, 67, 43], |
|
| 105 | + [2, 33, 15, 2, 34, 16], |
|
| 106 | + [2, 33, 11, 2, 34, 12], |
|
| 107 | 107 | // 6 |
| 108 | 108 | [2, 86, 68], |
| 109 | 109 | [4, 43, 27], |
@@ -116,14 +116,14 @@ discard block |
||
| 116 | 116 | [4, 39, 13, 1, 40, 14], |
| 117 | 117 | // 8 |
| 118 | 118 | [2, 121, 97], |
| 119 | - [2, 60, 38, 2, 61, 39], |
|
| 120 | - [4, 40, 18, 2, 41, 19], |
|
| 121 | - [4, 40, 14, 2, 41, 15], |
|
| 119 | + [2, 60, 38, 2, 61, 39], |
|
| 120 | + [4, 40, 18, 2, 41, 19], |
|
| 121 | + [4, 40, 14, 2, 41, 15], |
|
| 122 | 122 | // 9 |
| 123 | 123 | [2, 146, 116], |
| 124 | - [3, 58, 36, 2, 59, 37], |
|
| 125 | - [4, 36, 16, 4, 37, 17], |
|
| 126 | - [4, 36, 12, 4, 37, 13], |
|
| 124 | + [3, 58, 36, 2, 59, 37], |
|
| 125 | + [4, 36, 16, 4, 37, 17], |
|
| 126 | + [4, 36, 12, 4, 37, 13], |
|
| 127 | 127 | // 10 |
| 128 | 128 | [2, 86, 68, 2, 87, 69], |
| 129 | 129 | [4, 69, 43, 1, 70, 44], |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | foreach($range2 as $col){ |
| 293 | 293 | |
| 294 | 294 | if( |
| 295 | - $this->matrix[$row][$col ] |
|
| 295 | + $this->matrix[$row][$col ] |
|
| 296 | 296 | && !$this->matrix[$row][$col + 1] |
| 297 | 297 | && $this->matrix[$row][$col + 2] |
| 298 | 298 | && $this->matrix[$row][$col + 3] |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | foreach($range2 as $row){ |
| 311 | 311 | |
| 312 | 312 | if( |
| 313 | - $this->matrix[$row ][$col] |
|
| 313 | + $this->matrix[$row ][$col] |
|
| 314 | 314 | && !$this->matrix[$row + 1][$col] |
| 315 | 315 | && $this->matrix[$row + 2][$col] |
| 316 | 316 | && $this->matrix[$row + 3][$col] |
@@ -649,7 +649,7 @@ discard block |
||
| 649 | 649 | for($row = -2; $row <= 2; $row++){ |
| 650 | 650 | for($col = -2; $col <= 2; $col++){ |
| 651 | 651 | $this->matrix[$posI + $row][$posJ + $col] = |
| 652 | - $row === -2 || $row === 2 |
|
| 652 | + $row === -2 || $row === 2 |
|
| 653 | 653 | || $col === -2 || $col === 2 |
| 654 | 654 | || ($row === 0 && $col === 0); |
| 655 | 655 | } |
@@ -41,15 +41,15 @@ discard block |
||
| 41 | 41 | const ERROR_CORRECT_LEVEL_H = 2; // 30%. |
| 42 | 42 | |
| 43 | 43 | // max bits @ ec level L:07 M:15 Q:25 H:30 % |
| 44 | - const TYPE_01 = 1; // 152 128 104 72 |
|
| 45 | - const TYPE_02 = 2; // 272 224 176 128 |
|
| 46 | - const TYPE_03 = 3; // 440 352 272 208 |
|
| 47 | - const TYPE_04 = 4; // 640 512 384 288 |
|
| 48 | - const TYPE_05 = 5; // 864 688 496 368 |
|
| 49 | - const TYPE_06 = 6; // 1088 864 608 480 |
|
| 50 | - const TYPE_07 = 7; // 1248 992 704 528 |
|
| 51 | - const TYPE_08 = 8; // 1552 1232 880 688 |
|
| 52 | - const TYPE_09 = 9; // 1856 1456 1056 800 |
|
| 44 | + const TYPE_01 = 1; // 152 128 104 72 |
|
| 45 | + const TYPE_02 = 2; // 272 224 176 128 |
|
| 46 | + const TYPE_03 = 3; // 440 352 272 208 |
|
| 47 | + const TYPE_04 = 4; // 640 512 384 288 |
|
| 48 | + const TYPE_05 = 5; // 864 688 496 368 |
|
| 49 | + const TYPE_06 = 6; // 1088 864 608 480 |
|
| 50 | + const TYPE_07 = 7; // 1248 992 704 528 |
|
| 51 | + const TYPE_08 = 8; // 1552 1232 880 688 |
|
| 52 | + const TYPE_09 = 9; // 1856 1456 1056 800 |
|
| 53 | 53 | const TYPE_10 = 10; // 2192 1728 1232 976 |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -270,9 +270,9 @@ discard block |
||
| 270 | 270 | $count = 0; |
| 271 | 271 | |
| 272 | 272 | if( |
| 273 | - $this->matrix[$row ][$col ] |
|
| 274 | - || $this->matrix[$row ][$col + 1] |
|
| 275 | - || $this->matrix[$row + 1][$col ] |
|
| 273 | + $this->matrix[$row][$col] |
|
| 274 | + || $this->matrix[$row][$col + 1] |
|
| 275 | + || $this->matrix[$row + 1][$col] |
|
| 276 | 276 | || $this->matrix[$row + 1][$col + 1] |
| 277 | 277 | ){ |
| 278 | 278 | $count++; |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | foreach($range2 as $col){ |
| 300 | 300 | |
| 301 | 301 | if( |
| 302 | - $this->matrix[$row][$col ] |
|
| 302 | + $this->matrix[$row][$col] |
|
| 303 | 303 | && !$this->matrix[$row][$col + 1] |
| 304 | 304 | && $this->matrix[$row][$col + 2] |
| 305 | 305 | && $this->matrix[$row][$col + 3] |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | foreach($range2 as $row){ |
| 318 | 318 | |
| 319 | 319 | if( |
| 320 | - $this->matrix[$row ][$col] |
|
| 320 | + $this->matrix[$row][$col] |
|
| 321 | 321 | && !$this->matrix[$row + 1][$col] |
| 322 | 322 | && $this->matrix[$row + 2][$col] |
| 323 | 323 | && $this->matrix[$row + 3][$col] |
@@ -360,11 +360,11 @@ discard block |
||
| 360 | 360 | $this->lostPoint = 0; |
| 361 | 361 | $this->darkCount = 0; |
| 362 | 362 | |
| 363 | - $range = range(0, $this->pixelCount-1); |
|
| 363 | + $range = range(0, $this->pixelCount - 1); |
|
| 364 | 364 | |
| 365 | 365 | $this->testLevel1($range); |
| 366 | - $this->testLevel2(range(0, $this->pixelCount-2)); |
|
| 367 | - $this->testLevel3($range, range(0, $this->pixelCount-7)); |
|
| 366 | + $this->testLevel2(range(0, $this->pixelCount - 2)); |
|
| 367 | + $this->testLevel3($range, range(0, $this->pixelCount - 7)); |
|
| 368 | 368 | $this->testLevel4($range); |
| 369 | 369 | |
| 370 | 370 | $this->lostPoint += (abs(100 * $this->darkCount / $this->pixelCount / $this->pixelCount - 50) / 5) * 10; |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | $a = (int)floor($i / 3); |
| 389 | 389 | $b = $i % 3 + $this->pixelCount - 8 - 3; |
| 390 | 390 | |
| 391 | - $this->matrix[$a][$b] = $this->matrix[$b][$a] = !$test && (($bits >> $i) & 1) === 1; |
|
| 391 | + $this->matrix[$a][$b] = $this->matrix[$b][$a] = !$test && (($bits >> $i)&1) === 1; |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | } |
@@ -401,13 +401,13 @@ discard block |
||
| 401 | 401 | */ |
| 402 | 402 | protected function setTypeInfo(bool $test, int $pattern){ |
| 403 | 403 | $this->setPattern(); |
| 404 | - $bits = Util::getBCHTypeInfo(($this->errorCorrectLevel << 3) | $pattern); |
|
| 404 | + $bits = Util::getBCHTypeInfo(($this->errorCorrectLevel << 3)|$pattern); |
|
| 405 | 405 | |
| 406 | 406 | for($i = 0; $i < 15; $i++){ |
| 407 | - $mod = !$test && (($bits >> $i) & 1) === 1; |
|
| 407 | + $mod = !$test && (($bits >> $i)&1) === 1; |
|
| 408 | 408 | |
| 409 | 409 | switch(true){ |
| 410 | - case $i < 6: $this->matrix[$i ][8] = $mod; break; |
|
| 410 | + case $i < 6: $this->matrix[$i][8] = $mod; break; |
|
| 411 | 411 | case $i < 8: $this->matrix[$i + 1][8] = $mod; break; |
| 412 | 412 | default: |
| 413 | 413 | $this->matrix[$this->pixelCount - 15 + $i][8] = $mod; |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | |
| 416 | 416 | switch(true){ |
| 417 | 417 | case $i < 8: $this->matrix[8][$this->pixelCount - $i - 1] = $mod; break; |
| 418 | - case $i < 9: $this->matrix[8][ 15 + 1 - $i - 1] = $mod; break; |
|
| 418 | + case $i < 9: $this->matrix[8][15 + 1 - $i - 1] = $mod; break; |
|
| 419 | 419 | default: |
| 420 | 420 | $this->matrix[8][15 - $i - 1] = $mod; |
| 421 | 421 | } |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | |
| 497 | 497 | foreach($dcdata[$key] as $i => &$_dcdata){ |
| 498 | 498 | $bdata = $this->bitBuffer->buffer; |
| 499 | - $_dcdata = 0xff & $bdata[$i + $offset]; |
|
| 499 | + $_dcdata = 0xff&$bdata[$i + $offset]; |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | $offset += $rsBlockDataCount; |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | $dark = false; |
| 573 | 573 | |
| 574 | 574 | if($byteIndex < $dataCount){ |
| 575 | - $dark = (($data[$byteIndex] >> $bitIndex) & 1) === 1; |
|
| 575 | + $dark = (($data[$byteIndex] >> $bitIndex)&1) === 1; |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | $a = $row + $_col; |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | $this->matrix[$row + $r][$col + $c] = |
| 634 | 634 | (0 <= $r && $r <= 6 && ($c === 0 || $c === 6)) |
| 635 | 635 | || (0 <= $c && $c <= 6 && ($r === 0 || $r === 6)) |
| 636 | - || (2 <= $c && $c <= 4 && 2 <= $r && $r <= 4); |
|
| 636 | + || (2 <= $c && $c <= 4 && 2 <= $r && $r <= 4); |
|
| 637 | 637 | } |
| 638 | 638 | } |
| 639 | 639 | } |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | $this->matrix[$posI + $row][$posJ + $col] = |
| 658 | 658 | $row === -2 || $row === 2 |
| 659 | 659 | || $col === -2 || $col === 2 |
| 660 | - || ($row === 0 && $col === 0); |
|
| 660 | + || ($row === 0 && $col === 0); |
|
| 661 | 661 | } |
| 662 | 662 | } |
| 663 | 663 | } |
@@ -63,8 +63,8 @@ |
||
| 63 | 63 | foreach($row as $c => $pixel){ |
| 64 | 64 | if($pixel){ |
| 65 | 65 | imagefilledrectangle($image, |
| 66 | - $this->options->marginSize + $c * $this->options->pixelSize, |
|
| 67 | - $this->options->marginSize + $r * $this->options->pixelSize, |
|
| 66 | + $this->options->marginSize + $c * $this->options->pixelSize, |
|
| 67 | + $this->options->marginSize + $r * $this->options->pixelSize, |
|
| 68 | 68 | $this->options->marginSize + ($c + 1) * $this->options->pixelSize - 1, |
| 69 | 69 | $this->options->marginSize + ($r + 1) * $this->options->pixelSize - 1, |
| 70 | 70 | $foreground); |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | $this->options = new $this->optionsInterface; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if(is_array($this->types) && !in_array($this->options->type, $this->types , true)){ |
|
| 56 | + if(is_array($this->types) && !in_array($this->options->type, $this->types, true)){ |
|
| 57 | 57 | throw new QRCodeOutputException('Invalid output type!'); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | // svg header |
| 84 | 84 | $svg = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'.$length.'" height="'.$length.'" viewBox="0 0 '.$length.' '.$length.'" style="background-color:'.$this->options->bgColor.'">'.$this->options->eol. |
| 85 | - '<defs><style>.'.$class.'{fill:'.$this->options->fgColor.'} rect{shape-rendering:crispEdges}</style></defs>'.$this->options->eol; |
|
| 85 | + '<defs><style>.'.$class.'{fill:'.$this->options->fgColor.'} rect{shape-rendering:crispEdges}</style></defs>'.$this->options->eol; |
|
| 86 | 86 | |
| 87 | 87 | // svg body |
| 88 | 88 | foreach($this->matrix as $r => $row){ |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | } |
| 101 | 101 | elseif($from >= 0){ |
| 102 | 102 | $svg .= '<rect x="'.($from * $this->options->pixelSize + $this->options->marginSize).'" y="'.($r * $this->options->pixelSize + $this->options->marginSize) |
| 103 | - .'" width="'.($this->options->pixelSize * $count).'" height="'.$this->options->pixelSize.'" class="'.$class.'" />'.$this->options->eol; |
|
| 103 | + .'" width="'.($this->options->pixelSize * $count).'" height="'.$this->options->pixelSize.'" class="'.$class.'" />'.$this->options->eol; |
|
| 104 | 104 | |
| 105 | 105 | // reset count |
| 106 | 106 | $from = -1; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | // close off the row, if applicable |
| 112 | 112 | if($from >= 0){ |
| 113 | 113 | $svg .= '<rect x="'.($from * $this->options->pixelSize + $this->options->marginSize).'" y="'.($r * $this->options->pixelSize + $this->options->marginSize) |
| 114 | - .'" width="'.($this->options->pixelSize * $count).'" height="'.$this->options->pixelSize.'" class="'.$class.'" />'.$this->options->eol; |
|
| 114 | + .'" width="'.($this->options->pixelSize * $count).'" height="'.$this->options->pixelSize.'" class="'.$class.'" />'.$this->options->eol; |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | * @param \chillerlan\QRCode\BitBuffer $buffer |
| 26 | 26 | * @return void |
| 27 | 27 | */ |
| 28 | - public function write(BitBuffer &$buffer); |
|
| 28 | + public function write(BitBuffer&$buffer); |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * @param $type |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | * @return void |
| 36 | 36 | * @throws \chillerlan\QRCode\Data\QRCodeDataException |
| 37 | 37 | */ |
| 38 | - public function write(BitBuffer &$buffer){ |
|
| 38 | + public function write(BitBuffer&$buffer){ |
|
| 39 | 39 | |
| 40 | 40 | $i = 0; |
| 41 | 41 | while($i + 1 < $this->dataLength){ |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | * |
| 47 | 47 | * @return void |
| 48 | 48 | */ |
| 49 | - public function write(BitBuffer &$buffer){ |
|
| 49 | + public function write(BitBuffer&$buffer){ |
|
| 50 | 50 | $i = 0; |
| 51 | 51 | |
| 52 | 52 | while($i + 1 < $this->dataLength){ |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | * |
| 35 | 35 | * @return void |
| 36 | 36 | */ |
| 37 | - public function write(BitBuffer &$buffer){ |
|
| 37 | + public function write(BitBuffer&$buffer){ |
|
| 38 | 38 | $i = 0; |
| 39 | 39 | |
| 40 | 40 | while($i + 2 < $this->dataLength){ |