@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * |
19 | 19 | */ |
20 | -class QRImage extends QROutputBase implements QROutputInterface{ |
|
20 | +class QRImage extends QROutputBase implements QROutputInterface { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * @var \chillerlan\QRCode\Output\QRImageOptions $outputOptions |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | /** |
28 | 28 | * @var \chillerlan\QRCode\Output\QRImageOptions $outputOptions |
29 | 29 | */ |
30 | - public function __construct(QRImageOptions $outputOptions = null){ |
|
30 | + public function __construct(QRImageOptions $outputOptions = null) { |
|
31 | 31 | $this->options = $outputOptions; |
32 | 32 | |
33 | - if(!$this->options instanceof QRImageOptions){ |
|
33 | + if (!$this->options instanceof QRImageOptions) { |
|
34 | 34 | $this->options = new QRImageOptions; |
35 | 35 | } |
36 | 36 | |
@@ -38,21 +38,21 @@ discard block |
||
38 | 38 | $this->options->pixelSize = max(1, min(25, (int)$this->options->pixelSize)); |
39 | 39 | $this->options->marginSize = max(0, min(25, (int)$this->options->marginSize)); |
40 | 40 | |
41 | - foreach(['fgRed', 'fgGreen', 'fgBlue', 'bgRed', 'bgGreen', 'bgBlue',] as $val){ |
|
41 | + foreach (['fgRed', 'fgGreen', 'fgBlue', 'bgRed', 'bgGreen', 'bgBlue', ] as $val) { |
|
42 | 42 | $this->options->{$val} = max(0, min(255, (int)$this->options->{$val})); |
43 | 43 | } |
44 | 44 | |
45 | - if(!in_array($this->options->type, [QRCode::OUTPUT_IMAGE_PNG, QRCode::OUTPUT_IMAGE_JPG, QRCode::OUTPUT_IMAGE_GIF])){ |
|
45 | + if (!in_array($this->options->type, [QRCode::OUTPUT_IMAGE_PNG, QRCode::OUTPUT_IMAGE_JPG, QRCode::OUTPUT_IMAGE_GIF])) { |
|
46 | 46 | $this->options->type = QRCode::OUTPUT_IMAGE_PNG; |
47 | 47 | } |
48 | 48 | |
49 | 49 | $this->options->transparent = (bool)$this->options->transparent && $this->options->type !== QRCode::OUTPUT_IMAGE_JPG; |
50 | 50 | |
51 | - if(!in_array($this->options->pngCompression, range(-1, 9), true)){ |
|
51 | + if (!in_array($this->options->pngCompression, range(-1, 9), true)) { |
|
52 | 52 | $this->options->pngCompression = -1; |
53 | 53 | } |
54 | 54 | |
55 | - if(!in_array($this->options->jpegQuality, range(0, 100), true)){ |
|
55 | + if (!in_array($this->options->jpegQuality, range(0, 100), true)) { |
|
56 | 56 | $this->options->jpegQuality = 85; |
57 | 57 | } |
58 | 58 | |
@@ -62,24 +62,24 @@ discard block |
||
62 | 62 | * @return mixed |
63 | 63 | * @throws \chillerlan\QRCode\Output\QRCodeOutputException |
64 | 64 | */ |
65 | - public function dump(){ |
|
65 | + public function dump() { |
|
66 | 66 | $length = $this->pixelCount * $this->options->pixelSize + $this->options->marginSize * 2; |
67 | 67 | $image = imagecreatetruecolor($length, $length); |
68 | 68 | $foreground = imagecolorallocate($image, $this->options->fgRed, $this->options->fgGreen, $this->options->fgBlue); |
69 | 69 | $background = imagecolorallocate($image, $this->options->bgRed, $this->options->bgGreen, $this->options->bgBlue); |
70 | 70 | |
71 | - if($this->options->transparent){ |
|
71 | + if ($this->options->transparent) { |
|
72 | 72 | imagecolortransparent($image, $background); |
73 | 73 | } |
74 | 74 | |
75 | 75 | imagefilledrectangle($image, 0, 0, $length, $length, $background); |
76 | 76 | |
77 | - for($r = 0; $r < $this->pixelCount; $r++){ |
|
78 | - for($c = 0; $c < $this->pixelCount; $c++){ |
|
79 | - if($this->matrix[$r][$c]){ |
|
77 | + for ($r = 0; $r < $this->pixelCount; $r++) { |
|
78 | + for ($c = 0; $c < $this->pixelCount; $c++) { |
|
79 | + if ($this->matrix[$r][$c]) { |
|
80 | 80 | imagefilledrectangle($image, |
81 | - $this->options->marginSize + $c * $this->options->pixelSize, |
|
82 | - $this->options->marginSize + $r * $this->options->pixelSize, |
|
81 | + $this->options->marginSize + $c * $this->options->pixelSize, |
|
82 | + $this->options->marginSize + $r * $this->options->pixelSize, |
|
83 | 83 | $this->options->marginSize + ($c + 1) * $this->options->pixelSize - 1, |
84 | 84 | $this->options->marginSize + ($r + 1) * $this->options->pixelSize - 1, |
85 | 85 | $foreground); |
@@ -89,17 +89,17 @@ discard block |
||
89 | 89 | |
90 | 90 | ob_start(); |
91 | 91 | |
92 | - switch($this->options->type){ |
|
93 | - case QRCode::OUTPUT_IMAGE_PNG: imagepng ($image, $this->options->cachefile, (int)$this->options->pngCompression); break; |
|
92 | + switch ($this->options->type) { |
|
93 | + case QRCode::OUTPUT_IMAGE_PNG: imagepng($image, $this->options->cachefile, (int)$this->options->pngCompression); break; |
|
94 | 94 | case QRCode::OUTPUT_IMAGE_JPG: imagejpeg($image, $this->options->cachefile, (int)$this->options->jpegQuality); break; |
95 | - case QRCode::OUTPUT_IMAGE_GIF: imagegif ($image, $this->options->cachefile); break; /** Actually, it's pronounced "DJIFF". *hides* */ |
|
95 | + case QRCode::OUTPUT_IMAGE_GIF: imagegif($image, $this->options->cachefile); break; /** Actually, it's pronounced "DJIFF". *hides* */ |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | $imageData = ob_get_contents(); |
99 | 99 | imagedestroy($image); |
100 | 100 | ob_end_clean(); |
101 | 101 | |
102 | - if((bool)$this->options->base64){ |
|
102 | + if ((bool)$this->options->base64) { |
|
103 | 103 | $imageData = 'data:image/'.$this->options->type.';base64,'.base64_encode($imageData); |
104 | 104 | } |
105 | 105 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | /** |
16 | 16 | * Class QRImageOptions |
17 | 17 | */ |
18 | -class QRImageOptions{ |
|
18 | +class QRImageOptions { |
|
19 | 19 | |
20 | 20 | public $type = QRCode::OUTPUT_IMAGE_PNG; |
21 | 21 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * |
17 | 17 | */ |
18 | -class QROutputBase{ |
|
18 | +class QROutputBase { |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @var array |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | * @return $this |
39 | 39 | * @throws \chillerlan\QRCode\Output\QRCodeOutputException |
40 | 40 | */ |
41 | - public function setMatrix(array $matrix){ |
|
41 | + public function setMatrix(array $matrix) { |
|
42 | 42 | $this->pixelCount = count($matrix); |
43 | 43 | |
44 | 44 | // specify valid range? |
45 | - if($this->pixelCount < 2 |
|
45 | + if ($this->pixelCount < 2 |
|
46 | 46 | || !isset($matrix[$this->pixelCount - 1]) |
47 | 47 | || $this->pixelCount !== count($matrix[$this->pixelCount - 1]) |
48 | - ){ |
|
48 | + ) { |
|
49 | 49 | throw new QRCodeOutputException('Invalid matrix!'); |
50 | 50 | } |
51 | 51 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | /** |
16 | 16 | * |
17 | 17 | */ |
18 | -interface QROutputInterface{ |
|
18 | +interface QROutputInterface { |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @return mixed |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | /** |
17 | 17 | * |
18 | 18 | */ |
19 | -class QRString extends QROutputBase implements QROutputInterface{ |
|
19 | +class QRString extends QROutputBase implements QROutputInterface { |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * @var \chillerlan\QRCode\Output\QRStringOptions |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | * @var \chillerlan\QRCode\Output\QRStringOptions $outputOptions |
28 | 28 | * @throws \chillerlan\QRCode\Output\QRCodeOutputException |
29 | 29 | */ |
30 | - public function __construct(QRStringOptions $outputOptions = null){ |
|
30 | + public function __construct(QRStringOptions $outputOptions = null) { |
|
31 | 31 | $this->options = $outputOptions; |
32 | 32 | |
33 | - if(!$this->options instanceof QRStringOptions){ |
|
33 | + if (!$this->options instanceof QRStringOptions) { |
|
34 | 34 | $this->options = new QRStringOptions; |
35 | 35 | } |
36 | 36 | |
37 | - if(!in_array($this->options->type, [QRCode::OUTPUT_STRING_TEXT, QRCode::OUTPUT_STRING_JSON, QRCode::OUTPUT_STRING_HTML], true)){ |
|
37 | + if (!in_array($this->options->type, [QRCode::OUTPUT_STRING_TEXT, QRCode::OUTPUT_STRING_JSON, QRCode::OUTPUT_STRING_HTML], true)) { |
|
38 | 38 | throw new QRCodeOutputException('Invalid string output type!'); |
39 | 39 | } |
40 | 40 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @return string |
45 | 45 | * @throws \chillerlan\QRCode\Output\QRCodeOutputException |
46 | 46 | */ |
47 | - public function dump(){ |
|
47 | + public function dump() { |
|
48 | 48 | return call_user_func([$this, [ |
49 | 49 | QRCode::OUTPUT_STRING_TEXT => 'toText', |
50 | 50 | QRCode::OUTPUT_STRING_JSON => 'toJSON', |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * @return string |
57 | 57 | */ |
58 | - public function toText(){ |
|
58 | + public function toText() { |
|
59 | 59 | $text = ''; |
60 | 60 | |
61 | - foreach($this->matrix as &$row){ |
|
62 | - foreach($row as &$col){ |
|
61 | + foreach ($this->matrix as &$row) { |
|
62 | + foreach ($row as &$col) { |
|
63 | 63 | $text .= $col |
64 | 64 | ? $this->options->textDark |
65 | 65 | : $this->options->textLight; |
@@ -74,20 +74,20 @@ discard block |
||
74 | 74 | /** |
75 | 75 | * @return string |
76 | 76 | */ |
77 | - public function toJSON(){ |
|
77 | + public function toJSON() { |
|
78 | 78 | return json_encode($this->matrix); |
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
82 | 82 | * @return string |
83 | 83 | */ |
84 | - public function toHTML(){ |
|
84 | + public function toHTML() { |
|
85 | 85 | $html = ''; |
86 | 86 | |
87 | - foreach($this->matrix as &$row){ |
|
87 | + foreach ($this->matrix as &$row) { |
|
88 | 88 | // in order to not bloat the output too much, we use the shortest possible valid HTML tags |
89 | 89 | $html .= '<'.$this->options->htmlRowTag.'>'; |
90 | - foreach($row as &$col){ |
|
90 | + foreach ($row as &$col) { |
|
91 | 91 | $tag = $col |
92 | 92 | ? 'b' // dark |
93 | 93 | : 'i'; // light |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $html .= '<'.$tag.'></'.$tag.'>'; |
96 | 96 | } |
97 | 97 | |
98 | - if(!(bool)$this->options->htmlOmitEndTag){ |
|
98 | + if (!(bool)$this->options->htmlOmitEndTag) { |
|
99 | 99 | $html .= '</'.$this->options->htmlRowTag.'>'; |
100 | 100 | } |
101 | 101 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | /** |
17 | 17 | * |
18 | 18 | */ |
19 | -class QRStringOptions{ |
|
19 | +class QRStringOptions { |
|
20 | 20 | |
21 | 21 | public $type = QRCode::OUTPUT_STRING_HTML; |
22 | 22 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * |
17 | 17 | */ |
18 | -class Polynomial{ |
|
18 | +class Polynomial { |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @var array |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param array $num |
39 | 39 | * @param int $shift |
40 | 40 | */ |
41 | - public function __construct(array $num = [1], $shift = 0){ |
|
41 | + public function __construct(array $num = [1], $shift = 0) { |
|
42 | 42 | $this->setNum($num, $shift)->setTables(); |
43 | 43 | } |
44 | 44 | |
@@ -48,17 +48,17 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return $this |
50 | 50 | */ |
51 | - public function setNum(array $num, $shift = 0){ |
|
51 | + public function setNum(array $num, $shift = 0) { |
|
52 | 52 | $offset = 0; |
53 | 53 | $numCount = count($num); |
54 | 54 | |
55 | - while($offset < $numCount && $num[$offset] === 0){ |
|
55 | + while ($offset < $numCount && $num[$offset] === 0) { |
|
56 | 56 | $offset++; |
57 | 57 | } |
58 | 58 | |
59 | 59 | $this->num = array_fill(0, $numCount - $offset + $shift, 0); |
60 | 60 | |
61 | - for($i = 0; $i < $numCount - $offset; $i++){ |
|
61 | + for ($i = 0; $i < $numCount - $offset; $i++) { |
|
62 | 62 | $this->num[$i] = $num[$i + $offset]; |
63 | 63 | } |
64 | 64 | |
@@ -68,18 +68,18 @@ discard block |
||
68 | 68 | /** |
69 | 69 | * |
70 | 70 | */ |
71 | - protected function setTables(){ |
|
71 | + protected function setTables() { |
|
72 | 72 | $this->EXP_TABLE = $this->LOG_TABLE = array_fill(0, 256, 0); |
73 | 73 | |
74 | - for($i = 0; $i < 8; $i++){ |
|
74 | + for ($i = 0; $i < 8; $i++) { |
|
75 | 75 | $this->EXP_TABLE[$i] = 1 << $i; |
76 | 76 | } |
77 | 77 | |
78 | - for($i = 8; $i < 256; $i++){ |
|
79 | - $this->EXP_TABLE[$i] = $this->EXP_TABLE[$i - 4] ^ $this->EXP_TABLE[$i - 5] ^ $this->EXP_TABLE[$i - 6] ^ $this->EXP_TABLE[$i - 8]; |
|
78 | + for ($i = 8; $i < 256; $i++) { |
|
79 | + $this->EXP_TABLE[$i] = $this->EXP_TABLE[$i - 4]^$this->EXP_TABLE[$i - 5]^$this->EXP_TABLE[$i - 6]^$this->EXP_TABLE[$i - 8]; |
|
80 | 80 | } |
81 | 81 | |
82 | - for($i = 0; $i < 255; $i++){ |
|
82 | + for ($i = 0; $i < 255; $i++) { |
|
83 | 83 | $this->LOG_TABLE[$this->EXP_TABLE[$i]] = $i; |
84 | 84 | } |
85 | 85 | |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | /** |
89 | 89 | * @param array $e |
90 | 90 | */ |
91 | - public function multiply(array $e){ |
|
91 | + public function multiply(array $e) { |
|
92 | 92 | $n = array_fill(0, count($this->num) + count($e) - 1, 0); |
93 | 93 | |
94 | - foreach($this->num as $i => &$vi){ |
|
95 | - foreach($e as $j => &$vj){ |
|
94 | + foreach ($this->num as $i => &$vi) { |
|
95 | + foreach ($e as $j => &$vj) { |
|
96 | 96 | $n[$i + $j] ^= $this->gexp($this->glog($vi) + $this->glog($vj)); |
97 | 97 | } |
98 | 98 | } |
@@ -103,15 +103,15 @@ discard block |
||
103 | 103 | /** |
104 | 104 | * @param array $e |
105 | 105 | */ |
106 | - public function mod(array $e){ |
|
106 | + public function mod(array $e) { |
|
107 | 107 | $n = $this->num; |
108 | 108 | |
109 | - if(count($n) - count($e) < 0){ |
|
109 | + if (count($n) - count($e) < 0) { |
|
110 | 110 | return; |
111 | 111 | } |
112 | 112 | |
113 | 113 | $ratio = $this->glog($n[0]) - $this->glog($e[0]); |
114 | - foreach($e as $i => &$v){ |
|
114 | + foreach ($e as $i => &$v) { |
|
115 | 115 | $n[$i] ^= $this->gexp($this->glog($v) + $ratio); |
116 | 116 | } |
117 | 117 | |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | * @return int |
125 | 125 | * @throws \chillerlan\QRCode\QRCodeException |
126 | 126 | */ |
127 | - public function glog($n){ |
|
127 | + public function glog($n) { |
|
128 | 128 | |
129 | - if($n < 1){ |
|
129 | + if ($n < 1) { |
|
130 | 130 | throw new QRCodeException('log('.$n.')'); |
131 | 131 | } |
132 | 132 | |
@@ -138,12 +138,12 @@ discard block |
||
138 | 138 | * |
139 | 139 | * @return int |
140 | 140 | */ |
141 | - public function gexp($n){ |
|
141 | + public function gexp($n) { |
|
142 | 142 | |
143 | - if($n < 0){ |
|
143 | + if ($n < 0) { |
|
144 | 144 | $n += 255; |
145 | 145 | } |
146 | - elseif($n >= 256){ |
|
146 | + elseif ($n >= 256) { |
|
147 | 147 | $n -= 255; |
148 | 148 | } |
149 | 149 |
@@ -142,8 +142,7 @@ |
||
142 | 142 | |
143 | 143 | if($n < 0){ |
144 | 144 | $n += 255; |
145 | - } |
|
146 | - elseif($n >= 256){ |
|
145 | + } elseif($n >= 256){ |
|
147 | 146 | $n -= 255; |
148 | 147 | } |
149 | 148 |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | for($row = 0; $row < $this->pixelCount; $row++){ |
253 | 253 | for($col = 0; $col < $this->pixelCount - 6; $col++){ |
254 | 254 | if( |
255 | - $this->matrix[$row][$col ] |
|
255 | + $this->matrix[$row][$col ] |
|
256 | 256 | && !$this->matrix[$row][$col + 1] |
257 | 257 | && $this->matrix[$row][$col + 2] |
258 | 258 | && $this->matrix[$row][$col + 3] |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | for($col = 0; $col < $this->pixelCount; $col++){ |
269 | 269 | for($row = 0; $row < $this->pixelCount - 6; $row++){ |
270 | 270 | if( |
271 | - $this->matrix[$row ][$col] |
|
271 | + $this->matrix[$row ][$col] |
|
272 | 272 | && !$this->matrix[$row + 1][$col] |
273 | 273 | && $this->matrix[$row + 2][$col] |
274 | 274 | && $this->matrix[$row + 3][$col] |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @link https://github.com/kazuhikoarase/qrcode-generator/tree/master/php |
23 | 23 | * @link http://www.thonky.com/qr-code-tutorial/ |
24 | 24 | */ |
25 | -class QRCode{ |
|
25 | +class QRCode { |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * API constants |
@@ -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 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @param \chillerlan\QRCode\Output\QROutputInterface $output |
95 | 95 | * @param \chillerlan\QRCode\QROptions $options |
96 | 96 | */ |
97 | - public function __construct($data, QROutputInterface $output, QROptions $options = null){ |
|
97 | + public function __construct($data, QROutputInterface $output, QROptions $options = null) { |
|
98 | 98 | $this->qrOutputInterface = $output; |
99 | 99 | $this->bitBuffer = new BitBuffer; |
100 | 100 | $this->setData($data, $options); |
@@ -107,24 +107,24 @@ discard block |
||
107 | 107 | * @return $this |
108 | 108 | * @throws \chillerlan\QRCode\QRCodeException |
109 | 109 | */ |
110 | - public function setData($data, QROptions $options = null){ |
|
110 | + public function setData($data, QROptions $options = null) { |
|
111 | 111 | $data = trim($data); |
112 | 112 | |
113 | - if(empty($data)){ |
|
113 | + if (empty($data)) { |
|
114 | 114 | throw new QRCodeException('No data given.'); |
115 | 115 | } |
116 | 116 | |
117 | - if(!$options instanceof QROptions){ |
|
117 | + if (!$options instanceof QROptions) { |
|
118 | 118 | $options = new QROptions; |
119 | 119 | } |
120 | 120 | |
121 | - if(!in_array($options->errorCorrectLevel, QRConst::RSBLOCK, true)){ |
|
121 | + if (!in_array($options->errorCorrectLevel, QRConst::RSBLOCK, true)) { |
|
122 | 122 | throw new QRCodeException('Invalid error correct level: '.$options->errorCorrectLevel); |
123 | 123 | } |
124 | 124 | |
125 | 125 | $this->errorCorrectLevel = $options->errorCorrectLevel; |
126 | 126 | |
127 | - switch(true){ |
|
127 | + switch (true) { |
|
128 | 128 | case Util::isAlphaNum($data): |
129 | 129 | $mode = Util::isNumber($data) ? QRConst::MODE_NUMBER : QRConst::MODE_ALPHANUM; |
130 | 130 | break; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | |
148 | 148 | $this->typeNumber = intval($options->typeNumber); |
149 | 149 | |
150 | - if($this->typeNumber < 1 || $this->typeNumber > 10){ |
|
150 | + if ($this->typeNumber < 1 || $this->typeNumber > 10) { |
|
151 | 151 | $this->typeNumber = $this->getTypeNumber($mode); |
152 | 152 | } |
153 | 153 | |
@@ -160,14 +160,14 @@ discard block |
||
160 | 160 | * @return int |
161 | 161 | * @throws \chillerlan\QRCode\QRCodeException |
162 | 162 | */ |
163 | - protected function getTypeNumber($mode){ |
|
163 | + protected function getTypeNumber($mode) { |
|
164 | 164 | /** @noinspection PhpUndefinedFieldInspection */ |
165 | 165 | $length = $this->qrDataInterface->mode === QRConst::MODE_KANJI |
166 | 166 | ? floor($this->qrDataInterface->dataLength / 2) |
167 | 167 | : $this->qrDataInterface->dataLength; |
168 | 168 | |
169 | - for($type = 1; $type <= 10; $type++){ |
|
170 | - if($length <= Util::getMaxLength($type, $mode, $this->errorCorrectLevel)){ |
|
169 | + for ($type = 1; $type <= 10; $type++) { |
|
170 | + if ($length <= Util::getMaxLength($type, $mode, $this->errorCorrectLevel)) { |
|
171 | 171 | return $type; |
172 | 172 | } |
173 | 173 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | /** |
179 | 179 | * @return mixed |
180 | 180 | */ |
181 | - public function output(){ |
|
181 | + public function output() { |
|
182 | 182 | $this->qrOutputInterface->setMatrix($this->getRawData()); |
183 | 183 | return $this->qrOutputInterface->dump(); |
184 | 184 | } |
@@ -186,33 +186,33 @@ discard block |
||
186 | 186 | /** |
187 | 187 | * @return array |
188 | 188 | */ |
189 | - public function getRawData(){ |
|
189 | + public function getRawData() { |
|
190 | 190 | $minLostPoint = 0; |
191 | 191 | $maskPattern = 0; |
192 | 192 | |
193 | - for($pattern = 0; $pattern <= 7; $pattern++){ |
|
193 | + for ($pattern = 0; $pattern <= 7; $pattern++) { |
|
194 | 194 | $this->getMatrix(true, $pattern); |
195 | 195 | $lostPoint = 0; |
196 | 196 | |
197 | 197 | // LEVEL1 |
198 | - for($row = 0; $row < $this->pixelCount; $row++){ |
|
199 | - for($col = 0; $col < $this->pixelCount; $col++){ |
|
198 | + for ($row = 0; $row < $this->pixelCount; $row++) { |
|
199 | + for ($col = 0; $col < $this->pixelCount; $col++) { |
|
200 | 200 | $sameCount = 0; |
201 | 201 | $dark = $this->matrix[$row][$col]; |
202 | 202 | |
203 | - for($r = -1; $r <= 1; $r++){ |
|
203 | + for ($r = -1; $r <= 1; $r++) { |
|
204 | 204 | |
205 | - if($row + $r < 0 || $this->pixelCount <= $row + $r){ |
|
205 | + if ($row + $r < 0 || $this->pixelCount <= $row + $r) { |
|
206 | 206 | continue; |
207 | 207 | } |
208 | 208 | |
209 | - for($c = -1; $c <= 1; $c++){ |
|
209 | + for ($c = -1; $c <= 1; $c++) { |
|
210 | 210 | |
211 | - if(($r === 0 && $c === 0) || ($col + $c < 0 || $this->pixelCount <= $col + $c)){ |
|
211 | + if (($r === 0 && $c === 0) || ($col + $c < 0 || $this->pixelCount <= $col + $c)) { |
|
212 | 212 | continue; |
213 | 213 | } |
214 | 214 | |
215 | - if($this->matrix[$row + $r][$col + $c] === $dark){ |
|
215 | + if ($this->matrix[$row + $r][$col + $c] === $dark) { |
|
216 | 216 | $sameCount++; |
217 | 217 | } |
218 | 218 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | |
221 | 221 | } |
222 | 222 | |
223 | - if($sameCount > 5){ |
|
223 | + if ($sameCount > 5) { |
|
224 | 224 | $lostPoint += (3 + $sameCount - 5); |
225 | 225 | } |
226 | 226 | |
@@ -228,20 +228,20 @@ discard block |
||
228 | 228 | } |
229 | 229 | |
230 | 230 | // LEVEL2 |
231 | - for($row = 0; $row < $this->pixelCount - 1; $row++){ |
|
232 | - for($col = 0; $col < $this->pixelCount - 1; $col++){ |
|
231 | + for ($row = 0; $row < $this->pixelCount - 1; $row++) { |
|
232 | + for ($col = 0; $col < $this->pixelCount - 1; $col++) { |
|
233 | 233 | $count = 0; |
234 | 234 | |
235 | - if( |
|
236 | - $this->matrix[$row ][$col ] |
|
237 | - || $this->matrix[$row ][$col + 1] |
|
238 | - || $this->matrix[$row + 1][$col ] |
|
235 | + if ( |
|
236 | + $this->matrix[$row][$col] |
|
237 | + || $this->matrix[$row][$col + 1] |
|
238 | + || $this->matrix[$row + 1][$col] |
|
239 | 239 | || $this->matrix[$row + 1][$col + 1] |
240 | - ){ |
|
240 | + ) { |
|
241 | 241 | $count++; |
242 | 242 | } |
243 | 243 | |
244 | - if($count === 0 || $count === 4){ |
|
244 | + if ($count === 0 || $count === 4) { |
|
245 | 245 | $lostPoint += 3; |
246 | 246 | } |
247 | 247 | |
@@ -249,33 +249,33 @@ discard block |
||
249 | 249 | } |
250 | 250 | |
251 | 251 | // LEVEL3 |
252 | - for($row = 0; $row < $this->pixelCount; $row++){ |
|
253 | - for($col = 0; $col < $this->pixelCount - 6; $col++){ |
|
254 | - if( |
|
255 | - $this->matrix[$row][$col ] |
|
252 | + for ($row = 0; $row < $this->pixelCount; $row++) { |
|
253 | + for ($col = 0; $col < $this->pixelCount - 6; $col++) { |
|
254 | + if ( |
|
255 | + $this->matrix[$row][$col] |
|
256 | 256 | && !$this->matrix[$row][$col + 1] |
257 | 257 | && $this->matrix[$row][$col + 2] |
258 | 258 | && $this->matrix[$row][$col + 3] |
259 | 259 | && $this->matrix[$row][$col + 4] |
260 | 260 | && !$this->matrix[$row][$col + 5] |
261 | 261 | && $this->matrix[$row][$col + 6] |
262 | - ){ |
|
262 | + ) { |
|
263 | 263 | $lostPoint += 40; |
264 | 264 | } |
265 | 265 | } |
266 | 266 | } |
267 | 267 | |
268 | - for($col = 0; $col < $this->pixelCount; $col++){ |
|
269 | - for($row = 0; $row < $this->pixelCount - 6; $row++){ |
|
270 | - if( |
|
271 | - $this->matrix[$row ][$col] |
|
268 | + for ($col = 0; $col < $this->pixelCount; $col++) { |
|
269 | + for ($row = 0; $row < $this->pixelCount - 6; $row++) { |
|
270 | + if ( |
|
271 | + $this->matrix[$row][$col] |
|
272 | 272 | && !$this->matrix[$row + 1][$col] |
273 | 273 | && $this->matrix[$row + 2][$col] |
274 | 274 | && $this->matrix[$row + 3][$col] |
275 | 275 | && $this->matrix[$row + 4][$col] |
276 | 276 | && !$this->matrix[$row + 5][$col] |
277 | 277 | && $this->matrix[$row + 6][$col] |
278 | - ){ |
|
278 | + ) { |
|
279 | 279 | $lostPoint += 40; |
280 | 280 | } |
281 | 281 | } |
@@ -283,9 +283,9 @@ discard block |
||
283 | 283 | |
284 | 284 | // LEVEL4 |
285 | 285 | $darkCount = 0; |
286 | - for($col = 0; $col < $this->pixelCount; $col++){ |
|
287 | - for($row = 0; $row < $this->pixelCount; $row++){ |
|
288 | - if($this->matrix[$row][$col]){ |
|
286 | + for ($col = 0; $col < $this->pixelCount; $col++) { |
|
287 | + for ($row = 0; $row < $this->pixelCount; $row++) { |
|
288 | + if ($this->matrix[$row][$col]) { |
|
289 | 289 | $darkCount++; |
290 | 290 | } |
291 | 291 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | $ratio = abs(100 * $darkCount / $this->pixelCount / $this->pixelCount - 50) / 5; |
295 | 295 | $lostPoint += $ratio * 10; |
296 | 296 | |
297 | - if($pattern === 0 || $minLostPoint > $lostPoint){ |
|
297 | + if ($pattern === 0 || $minLostPoint > $lostPoint) { |
|
298 | 298 | $minLostPoint = $lostPoint; |
299 | 299 | $maskPattern = $pattern; |
300 | 300 | } |
@@ -309,14 +309,14 @@ discard block |
||
309 | 309 | /** |
310 | 310 | * @param bool $test |
311 | 311 | */ |
312 | - protected function setTypeNumber($test){ |
|
312 | + protected function setTypeNumber($test) { |
|
313 | 313 | $bits = Util::getBCHTypeNumber($this->typeNumber); |
314 | 314 | |
315 | - for($i = 0; $i < 18; $i++){ |
|
315 | + for ($i = 0; $i < 18; $i++) { |
|
316 | 316 | $a = (int)floor($i / 3); |
317 | 317 | $b = $i % 3 + $this->pixelCount - 8 - 3; |
318 | 318 | |
319 | - $this->matrix[$a][$b] = $this->matrix[$b][$a] = !$test && (($bits >> $i) & 1) === 1; |
|
319 | + $this->matrix[$a][$b] = $this->matrix[$b][$a] = !$test && (($bits >> $i)&1) === 1; |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | } |
@@ -325,23 +325,23 @@ discard block |
||
325 | 325 | * @param bool $test |
326 | 326 | * @param int $pattern |
327 | 327 | */ |
328 | - protected function setTypeInfo($test, $pattern){ |
|
328 | + protected function setTypeInfo($test, $pattern) { |
|
329 | 329 | $this->setPattern(); |
330 | - $bits = Util::getBCHTypeInfo(($this->errorCorrectLevel << 3) | $pattern); |
|
330 | + $bits = Util::getBCHTypeInfo(($this->errorCorrectLevel << 3)|$pattern); |
|
331 | 331 | |
332 | - for($i = 0; $i < 15; $i++){ |
|
333 | - $mod = !$test && (($bits >> $i) & 1) === 1; |
|
332 | + for ($i = 0; $i < 15; $i++) { |
|
333 | + $mod = !$test && (($bits >> $i)&1) === 1; |
|
334 | 334 | |
335 | - switch(true){ |
|
336 | - case $i < 6:$this->matrix[$i ][8] = $mod; break; |
|
335 | + switch (true) { |
|
336 | + case $i < 6:$this->matrix[$i][8] = $mod; break; |
|
337 | 337 | case $i < 8:$this->matrix[$i + 1][8] = $mod; break; |
338 | 338 | default: |
339 | 339 | $this->matrix[$this->pixelCount - 15 + $i][8] = $mod; |
340 | 340 | } |
341 | 341 | |
342 | - switch(true){ |
|
342 | + switch (true) { |
|
343 | 343 | case $i < 8:$this->matrix[8][$this->pixelCount - $i - 1] = $mod; break; |
344 | - case $i < 9:$this->matrix[8][ 15 + 1 - $i - 1] = $mod; break; |
|
344 | + case $i < 9:$this->matrix[8][15 + 1 - $i - 1] = $mod; break; |
|
345 | 345 | default: |
346 | 346 | $this->matrix[8][15 - $i - 1] = $mod; |
347 | 347 | } |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | /** |
355 | 355 | * @throws \chillerlan\QRCode\QRCodeException |
356 | 356 | */ |
357 | - protected function createData(){ |
|
357 | + protected function createData() { |
|
358 | 358 | $this->bitBuffer->clear(); |
359 | 359 | |
360 | 360 | $MAX_BITS = QRConst::MAX_BITS; // php5 compat |
@@ -370,30 +370,30 @@ discard block |
||
370 | 370 | |
371 | 371 | $this->qrDataInterface->write($this->bitBuffer); |
372 | 372 | |
373 | - if($this->bitBuffer->length > $MAX_BITS){ |
|
373 | + if ($this->bitBuffer->length > $MAX_BITS) { |
|
374 | 374 | throw new QRCodeException('code length overflow. ('.$this->bitBuffer->length.' > '.$MAX_BITS.'bit)'); |
375 | 375 | } |
376 | 376 | |
377 | 377 | // end code. |
378 | - if($this->bitBuffer->length + 4 <= $MAX_BITS){ |
|
378 | + if ($this->bitBuffer->length + 4 <= $MAX_BITS) { |
|
379 | 379 | $this->bitBuffer->put(0, 4); |
380 | 380 | } |
381 | 381 | |
382 | 382 | // padding |
383 | - while($this->bitBuffer->length % 8 !== 0){ |
|
383 | + while ($this->bitBuffer->length % 8 !== 0) { |
|
384 | 384 | $this->bitBuffer->putBit(false); |
385 | 385 | } |
386 | 386 | |
387 | 387 | // padding |
388 | - while(true){ |
|
388 | + while (true) { |
|
389 | 389 | |
390 | - if($this->bitBuffer->length >= $MAX_BITS){ |
|
390 | + if ($this->bitBuffer->length >= $MAX_BITS) { |
|
391 | 391 | break; |
392 | 392 | } |
393 | 393 | |
394 | 394 | $this->bitBuffer->put(QRConst::PAD0, 8); |
395 | 395 | |
396 | - if($this->bitBuffer->length >= $MAX_BITS){ |
|
396 | + if ($this->bitBuffer->length >= $MAX_BITS) { |
|
397 | 397 | break; |
398 | 398 | } |
399 | 399 | |
@@ -406,13 +406,13 @@ discard block |
||
406 | 406 | * @return array |
407 | 407 | * @throws \chillerlan\QRCode\QRCodeException |
408 | 408 | */ |
409 | - protected function createBytes(){ |
|
409 | + protected function createBytes() { |
|
410 | 410 | $totalCodeCount = $maxDcCount = $maxEcCount = $offset = $index = 0; |
411 | 411 | $rsBlocks = Util::getRSBlocks($this->typeNumber, $this->errorCorrectLevel); |
412 | 412 | $rsBlockCount = count($rsBlocks); |
413 | 413 | $dcdata = $ecdata = array_fill(0, $rsBlockCount, null); |
414 | 414 | |
415 | - foreach($rsBlocks as $key => $value){ |
|
415 | + foreach ($rsBlocks as $key => $value) { |
|
416 | 416 | $rsBlockTotal = $value[0]; |
417 | 417 | $rsBlockDataCount = $value[1]; |
418 | 418 | |
@@ -421,9 +421,9 @@ discard block |
||
421 | 421 | |
422 | 422 | $dcdata[$key] = array_fill(0, $rsBlockDataCount, null); |
423 | 423 | |
424 | - foreach($dcdata[$key] as $i => &$_dcdata){ |
|
424 | + foreach ($dcdata[$key] as $i => &$_dcdata) { |
|
425 | 425 | $bdata = $this->bitBuffer->buffer; |
426 | - $_dcdata = 0xff & $bdata[$i + $offset]; |
|
426 | + $_dcdata = 0xff&$bdata[$i + $offset]; |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | $offset += $rsBlockDataCount; |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | $rsPoly = new Polynomial; |
432 | 432 | $modPoly = new Polynomial; |
433 | 433 | |
434 | - for($i = 0; $i < $rsBlockTotal - $rsBlockDataCount; $i++){ |
|
434 | + for ($i = 0; $i < $rsBlockTotal - $rsBlockDataCount; $i++) { |
|
435 | 435 | $modPoly->setNum([1, $modPoly->gexp($i)]); |
436 | 436 | $rsPoly->multiply($modPoly->num); |
437 | 437 | } |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | $ecdata[$key] = array_fill(0, $rsPolyCount - 1, null); |
442 | 442 | $add = count($modPoly->num) - count($ecdata[$key]); |
443 | 443 | |
444 | - foreach($ecdata[$key] as $i => &$_ecdata){ |
|
444 | + foreach ($ecdata[$key] as $i => &$_ecdata) { |
|
445 | 445 | $modIndex = $i + $add; |
446 | 446 | $_ecdata = $modIndex >= 0 ? $modPoly->num[$modIndex] : 0; |
447 | 447 | } |
@@ -451,17 +451,17 @@ discard block |
||
451 | 451 | |
452 | 452 | $data = array_fill(0, $totalCodeCount, null); |
453 | 453 | |
454 | - for($i = 0; $i < $maxDcCount; $i++){ |
|
455 | - for($key = 0; $key < $rsBlockCount; $key++){ |
|
456 | - if($i < count($dcdata[$key])){ |
|
454 | + for ($i = 0; $i < $maxDcCount; $i++) { |
|
455 | + for ($key = 0; $key < $rsBlockCount; $key++) { |
|
456 | + if ($i < count($dcdata[$key])) { |
|
457 | 457 | $data[$index++] = $dcdata[$key][$i]; |
458 | 458 | } |
459 | 459 | } |
460 | 460 | } |
461 | 461 | |
462 | - for($i = 0; $i < $maxEcCount; $i++){ |
|
463 | - for($key = 0; $key < $rsBlockCount; $key++){ |
|
464 | - if($i < count($ecdata[$key])){ |
|
462 | + for ($i = 0; $i < $maxEcCount; $i++) { |
|
463 | + for ($key = 0; $key < $rsBlockCount; $key++) { |
|
464 | + if ($i < count($ecdata[$key])) { |
|
465 | 465 | $data[$index++] = $ecdata[$key][$i]; |
466 | 466 | } |
467 | 467 | } |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | * |
476 | 476 | * @throws \chillerlan\QRCode\QRCodeException |
477 | 477 | */ |
478 | - protected function mapData($pattern){ |
|
478 | + protected function mapData($pattern) { |
|
479 | 479 | $this->createData(); |
480 | 480 | $data = $this->createBytes(); |
481 | 481 | $inc = -1; |
@@ -484,21 +484,21 @@ discard block |
||
484 | 484 | $byteIndex = 0; |
485 | 485 | $dataCount = count($data); |
486 | 486 | |
487 | - for($col = $this->pixelCount - 1; $col > 0; $col -= 2){ |
|
487 | + for ($col = $this->pixelCount - 1; $col > 0; $col -= 2) { |
|
488 | 488 | |
489 | - if($col === 6){ |
|
489 | + if ($col === 6) { |
|
490 | 490 | $col--; |
491 | 491 | } |
492 | 492 | |
493 | - while(true){ |
|
494 | - for($c = 0; $c < 2; $c++){ |
|
493 | + while (true) { |
|
494 | + for ($c = 0; $c < 2; $c++) { |
|
495 | 495 | $_col = $col - $c; |
496 | 496 | |
497 | - if($this->matrix[$row][$_col] === null){ |
|
497 | + if ($this->matrix[$row][$_col] === null) { |
|
498 | 498 | $dark = false; |
499 | 499 | |
500 | - if($byteIndex < $dataCount){ |
|
501 | - $dark = (($data[$byteIndex] >> $bitIndex) & 1) === 1; |
|
500 | + if ($byteIndex < $dataCount) { |
|
501 | + $dark = (($data[$byteIndex] >> $bitIndex)&1) === 1; |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | $a = $row + $_col; |
@@ -515,14 +515,14 @@ discard block |
||
515 | 515 | QRConst::MASK_PATTERN111 => ($m % 3 + $a % 2) % 2, |
516 | 516 | ][$pattern]; |
517 | 517 | |
518 | - if($MASK_PATTERN === 0){ |
|
518 | + if ($MASK_PATTERN === 0) { |
|
519 | 519 | $dark = !$dark; |
520 | 520 | } |
521 | 521 | |
522 | 522 | $this->matrix[$row][$_col] = $dark; |
523 | 523 | |
524 | 524 | $bitIndex--; |
525 | - if($bitIndex === -1){ |
|
525 | + if ($bitIndex === -1) { |
|
526 | 526 | $byteIndex++; |
527 | 527 | $bitIndex = 7; |
528 | 528 | } |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | |
533 | 533 | $row += $inc; |
534 | 534 | |
535 | - if($row < 0 || $this->pixelCount <= $row){ |
|
535 | + if ($row < 0 || $this->pixelCount <= $row) { |
|
536 | 536 | $row -= $inc; |
537 | 537 | $inc = -$inc; |
538 | 538 | break; |
@@ -547,17 +547,17 @@ discard block |
||
547 | 547 | /** |
548 | 548 | * @throws \chillerlan\QRCode\QRCodeException |
549 | 549 | */ |
550 | - protected function setPattern(){ |
|
550 | + protected function setPattern() { |
|
551 | 551 | |
552 | 552 | // setupPositionProbePattern |
553 | - foreach([[0, 0], [$this->pixelCount - 7, 0], [0, $this->pixelCount - 7]] as $grid){ |
|
553 | + foreach ([[0, 0], [$this->pixelCount - 7, 0], [0, $this->pixelCount - 7]] as $grid) { |
|
554 | 554 | $row = $grid[0]; |
555 | 555 | $col = $grid[1]; |
556 | 556 | |
557 | - for($r = -1; $r <= 7; $r++){ |
|
558 | - for($c = -1; $c <= 7; $c++){ |
|
557 | + for ($r = -1; $r <= 7; $r++) { |
|
558 | + for ($c = -1; $c <= 7; $c++) { |
|
559 | 559 | |
560 | - if($row + $r <= -1 || $this->pixelCount <= $row + $r || $col + $c <= -1 || $this->pixelCount <= $col + $c){ |
|
560 | + if ($row + $r <= -1 || $this->pixelCount <= $row + $r || $col + $c <= -1 || $this->pixelCount <= $col + $c) { |
|
561 | 561 | continue; |
562 | 562 | } |
563 | 563 | |
@@ -572,19 +572,19 @@ discard block |
||
572 | 572 | // setupPositionAdjustPattern |
573 | 573 | $PATTERN_POSITION = QRConst::PATTERN_POSITION; // PHP5 compat |
574 | 574 | $pos = $PATTERN_POSITION[$this->typeNumber - 1]; |
575 | - foreach($pos as $i => $posI){ |
|
576 | - foreach($pos as $j => $posJ){ |
|
575 | + foreach ($pos as $i => $posI) { |
|
576 | + foreach ($pos as $j => $posJ) { |
|
577 | 577 | |
578 | - if($this->matrix[$posI][$posJ] !== null){ |
|
578 | + if ($this->matrix[$posI][$posJ] !== null) { |
|
579 | 579 | continue; |
580 | 580 | } |
581 | 581 | |
582 | - for($row = -2; $row <= 2; $row++){ |
|
583 | - for($col = -2; $col <= 2; $col++){ |
|
582 | + for ($row = -2; $row <= 2; $row++) { |
|
583 | + for ($col = -2; $col <= 2; $col++) { |
|
584 | 584 | $this->matrix[$posI + $row][$posJ + $col] = |
585 | 585 | $row === -2 || $row === 2 |
586 | 586 | || $col === -2 || $col === 2 |
587 | - ||($row === 0 && $col === 0); |
|
587 | + ||($row === 0 && $col === 0); |
|
588 | 588 | } |
589 | 589 | } |
590 | 590 | |
@@ -592,9 +592,9 @@ discard block |
||
592 | 592 | } |
593 | 593 | |
594 | 594 | // setupTimingPattern |
595 | - for($i = 8; $i < $this->pixelCount - 8; $i++){ |
|
595 | + for ($i = 8; $i < $this->pixelCount - 8; $i++) { |
|
596 | 596 | |
597 | - if($this->matrix[$i][6] !== null){ |
|
597 | + if ($this->matrix[$i][6] !== null) { |
|
598 | 598 | continue; // @codeCoverageIgnore |
599 | 599 | } |
600 | 600 | |
@@ -609,12 +609,12 @@ discard block |
||
609 | 609 | * |
610 | 610 | * @throws \chillerlan\QRCode\QRCodeException |
611 | 611 | */ |
612 | - protected function getMatrix($test, $maskPattern){ |
|
612 | + protected function getMatrix($test, $maskPattern) { |
|
613 | 613 | $this->pixelCount = $this->typeNumber * 4 + 17; |
614 | 614 | $this->matrix = array_fill(0, $this->pixelCount, array_fill(0, $this->pixelCount, null)); |
615 | 615 | $this->setTypeInfo($test, $maskPattern); |
616 | 616 | |
617 | - if($this->typeNumber >= 7){ |
|
617 | + if ($this->typeNumber >= 7) { |
|
618 | 618 | $this->setTypeNumber($test); |
619 | 619 | } |
620 | 620 |
@@ -17,6 +17,6 @@ |
||
17 | 17 | /** |
18 | 18 | * Placeholder |
19 | 19 | */ |
20 | -class QRCodeException extends Exception{ |
|
20 | +class QRCodeException extends Exception { |
|
21 | 21 | |
22 | 22 | } |