Passed
Push — master ( 9506ad...523312 )
by ma
07:16 queued 03:35
created
src/Gateways/qrcode/QRimage.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 class QRimage {
29 29
 
30 30
     //----------------------------------------------------------------------
31
-    public static function png($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4,$saveandprint=FALSE)
31
+    public static function png($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4, $saveandprint = FALSE)
32 32
     {
33 33
         $image = self::image($frame, $pixelPerPoint, $outerFrame);
34 34
 
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
             Header("Content-type: image/png");
37 37
             ImagePng($image);
38 38
         } else {
39
-            if($saveandprint===TRUE){
39
+            if ($saveandprint === TRUE) {
40 40
                 ImagePng($image, $filename);
41 41
                 header("Content-type: image/png");
42 42
                 ImagePng($image);
43
-            }else{
43
+            } else {
44 44
                 ImagePng($image, $filename);
45 45
             }
46 46
         }
@@ -69,25 +69,25 @@  discard block
 block discarded – undo
69 69
         $h = count($frame);
70 70
         $w = strlen($frame[0]);
71 71
 
72
-        $imgW = $w + 2*$outerFrame;
73
-        $imgH = $h + 2*$outerFrame;
72
+        $imgW = $w + 2 * $outerFrame;
73
+        $imgH = $h + 2 * $outerFrame;
74 74
 
75
-        $base_image =ImageCreate($imgW, $imgH);
75
+        $base_image = ImageCreate($imgW, $imgH);
76 76
 
77
-        $col[0] = ImageColorAllocate($base_image,255,255,255);
78
-        $col[1] = ImageColorAllocate($base_image,0,0,0);
77
+        $col[0] = ImageColorAllocate($base_image, 255, 255, 255);
78
+        $col[1] = ImageColorAllocate($base_image, 0, 0, 0);
79 79
 
80 80
         imagefill($base_image, 0, 0, $col[0]);
81 81
 
82
-        for($y=0; $y<$h; $y++) {
83
-            for($x=0; $x<$w; $x++) {
82
+        for ($y = 0; $y < $h; $y++) {
83
+            for ($x = 0; $x < $w; $x++) {
84 84
                 if ($frame[$y][$x] == '1') {
85
-                    ImageSetPixel($base_image,$x+$outerFrame,$y+$outerFrame,$col[1]);
85
+                    ImageSetPixel($base_image, $x + $outerFrame, $y + $outerFrame, $col[1]);
86 86
                 }
87 87
             }
88 88
         }
89 89
 
90
-        $target_image =ImageCreate($imgW * $pixelPerPoint, $imgH * $pixelPerPoint);
90
+        $target_image = ImageCreate($imgW * $pixelPerPoint, $imgH * $pixelPerPoint);
91 91
         ImageCopyResized($target_image, $base_image, 0, 0, 0, 0, $imgW * $pixelPerPoint, $imgH * $pixelPerPoint, $imgW, $imgH);
92 92
         ImageDestroy($base_image);
93 93
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
                 ImagePng($image, $filename);
41 41
                 header("Content-type: image/png");
42 42
                 ImagePng($image);
43
-            }else{
43
+            } else{
44 44
                 ImagePng($image, $filename);
45 45
             }
46 46
         }
Please login to merge, or discard this patch.
src/Gateways/qrcode/QRrs.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@
 block discarded – undo
36 36
     //----------------------------------------------------------------------
37 37
     public static function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
38 38
     {
39
-        foreach(self::$items as $rs) {
40
-            if($rs->pad != $pad)       continue;
41
-            if($rs->nroots != $nroots) continue;
42
-            if($rs->mm != $symsize)    continue;
43
-            if($rs->gfpoly != $gfpoly) continue;
44
-            if($rs->fcr != $fcr)       continue;
45
-            if($rs->prim != $prim)     continue;
39
+        foreach (self::$items as $rs) {
40
+            if ($rs->pad != $pad)       continue;
41
+            if ($rs->nroots != $nroots) continue;
42
+            if ($rs->mm != $symsize)    continue;
43
+            if ($rs->gfpoly != $gfpoly) continue;
44
+            if ($rs->fcr != $fcr)       continue;
45
+            if ($rs->prim != $prim)     continue;
46 46
 
47 47
             return $rs;
48 48
         }
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,12 +37,24 @@
 block discarded – undo
37 37
     public static function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
38 38
     {
39 39
         foreach(self::$items as $rs) {
40
-            if($rs->pad != $pad)       continue;
41
-            if($rs->nroots != $nroots) continue;
42
-            if($rs->mm != $symsize)    continue;
43
-            if($rs->gfpoly != $gfpoly) continue;
44
-            if($rs->fcr != $fcr)       continue;
45
-            if($rs->prim != $prim)     continue;
40
+            if($rs->pad != $pad) {
41
+                continue;
42
+            }
43
+            if($rs->nroots != $nroots) {
44
+                continue;
45
+            }
46
+            if($rs->mm != $symsize) {
47
+                continue;
48
+            }
49
+            if($rs->gfpoly != $gfpoly) {
50
+                continue;
51
+            }
52
+            if($rs->fcr != $fcr) {
53
+                continue;
54
+            }
55
+            if($rs->prim != $prim) {
56
+                continue;
57
+            }
46 58
 
47 59
             return $rs;
48 60
         }
Please login to merge, or discard this patch.
src/Gateways/qrcode/QRspec.php 2 patches
Spacing   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -35,47 +35,47 @@  discard block
 block discarded – undo
35 35
 class QRspec {
36 36
 
37 37
     public static $capacity = array(
38
-        array(  0,    0, 0, array(   0,    0,    0,    0)),
39
-        array( 21,   26, 0, array(   7,   10,   13,   17)), // 1
40
-        array( 25,   44, 7, array(  10,   16,   22,   28)),
41
-        array( 29,   70, 7, array(  15,   26,   36,   44)),
42
-        array( 33,  100, 7, array(  20,   36,   52,   64)),
43
-        array( 37,  134, 7, array(  26,   48,   72,   88)), // 5
44
-        array( 41,  172, 7, array(  36,   64,   96,  112)),
45
-        array( 45,  196, 0, array(  40,   72,  108,  130)),
46
-        array( 49,  242, 0, array(  48,   88,  132,  156)),
47
-        array( 53,  292, 0, array(  60,  110,  160,  192)),
48
-        array( 57,  346, 0, array(  72,  130,  192,  224)), //10
49
-        array( 61,  404, 0, array(  80,  150,  224,  264)),
50
-        array( 65,  466, 0, array(  96,  176,  260,  308)),
51
-        array( 69,  532, 0, array( 104,  198,  288,  352)),
52
-        array( 73,  581, 3, array( 120,  216,  320,  384)),
53
-        array( 77,  655, 3, array( 132,  240,  360,  432)), //15
54
-        array( 81,  733, 3, array( 144,  280,  408,  480)),
55
-        array( 85,  815, 3, array( 168,  308,  448,  532)),
56
-        array( 89,  901, 3, array( 180,  338,  504,  588)),
57
-        array( 93,  991, 3, array( 196,  364,  546,  650)),
58
-        array( 97, 1085, 3, array( 224,  416,  600,  700)), //20
59
-        array(101, 1156, 4, array( 224,  442,  644,  750)),
60
-        array(105, 1258, 4, array( 252,  476,  690,  816)),
61
-        array(109, 1364, 4, array( 270,  504,  750,  900)),
62
-        array(113, 1474, 4, array( 300,  560,  810,  960)),
63
-        array(117, 1588, 4, array( 312,  588,  870, 1050)), //25
64
-        array(121, 1706, 4, array( 336,  644,  952, 1110)),
65
-        array(125, 1828, 4, array( 360,  700, 1020, 1200)),
66
-        array(129, 1921, 3, array( 390,  728, 1050, 1260)),
67
-        array(133, 2051, 3, array( 420,  784, 1140, 1350)),
68
-        array(137, 2185, 3, array( 450,  812, 1200, 1440)), //30
69
-        array(141, 2323, 3, array( 480,  868, 1290, 1530)),
70
-        array(145, 2465, 3, array( 510,  924, 1350, 1620)),
71
-        array(149, 2611, 3, array( 540,  980, 1440, 1710)),
72
-        array(153, 2761, 3, array( 570, 1036, 1530, 1800)),
73
-        array(157, 2876, 0, array( 570, 1064, 1590, 1890)), //35
74
-        array(161, 3034, 0, array( 600, 1120, 1680, 1980)),
75
-        array(165, 3196, 0, array( 630, 1204, 1770, 2100)),
76
-        array(169, 3362, 0, array( 660, 1260, 1860, 2220)),
77
-        array(173, 3532, 0, array( 720, 1316, 1950, 2310)),
78
-        array(177, 3706, 0, array( 750, 1372, 2040, 2430)) //40
38
+        array(0, 0, 0, array(0, 0, 0, 0)),
39
+        array(21, 26, 0, array(7, 10, 13, 17)), // 1
40
+        array(25, 44, 7, array(10, 16, 22, 28)),
41
+        array(29, 70, 7, array(15, 26, 36, 44)),
42
+        array(33, 100, 7, array(20, 36, 52, 64)),
43
+        array(37, 134, 7, array(26, 48, 72, 88)), // 5
44
+        array(41, 172, 7, array(36, 64, 96, 112)),
45
+        array(45, 196, 0, array(40, 72, 108, 130)),
46
+        array(49, 242, 0, array(48, 88, 132, 156)),
47
+        array(53, 292, 0, array(60, 110, 160, 192)),
48
+        array(57, 346, 0, array(72, 130, 192, 224)), //10
49
+        array(61, 404, 0, array(80, 150, 224, 264)),
50
+        array(65, 466, 0, array(96, 176, 260, 308)),
51
+        array(69, 532, 0, array(104, 198, 288, 352)),
52
+        array(73, 581, 3, array(120, 216, 320, 384)),
53
+        array(77, 655, 3, array(132, 240, 360, 432)), //15
54
+        array(81, 733, 3, array(144, 280, 408, 480)),
55
+        array(85, 815, 3, array(168, 308, 448, 532)),
56
+        array(89, 901, 3, array(180, 338, 504, 588)),
57
+        array(93, 991, 3, array(196, 364, 546, 650)),
58
+        array(97, 1085, 3, array(224, 416, 600, 700)), //20
59
+        array(101, 1156, 4, array(224, 442, 644, 750)),
60
+        array(105, 1258, 4, array(252, 476, 690, 816)),
61
+        array(109, 1364, 4, array(270, 504, 750, 900)),
62
+        array(113, 1474, 4, array(300, 560, 810, 960)),
63
+        array(117, 1588, 4, array(312, 588, 870, 1050)), //25
64
+        array(121, 1706, 4, array(336, 644, 952, 1110)),
65
+        array(125, 1828, 4, array(360, 700, 1020, 1200)),
66
+        array(129, 1921, 3, array(390, 728, 1050, 1260)),
67
+        array(133, 2051, 3, array(420, 784, 1140, 1350)),
68
+        array(137, 2185, 3, array(450, 812, 1200, 1440)), //30
69
+        array(141, 2323, 3, array(480, 868, 1290, 1530)),
70
+        array(145, 2465, 3, array(510, 924, 1350, 1620)),
71
+        array(149, 2611, 3, array(540, 980, 1440, 1710)),
72
+        array(153, 2761, 3, array(570, 1036, 1530, 1800)),
73
+        array(157, 2876, 0, array(570, 1064, 1590, 1890)), //35
74
+        array(161, 3034, 0, array(600, 1120, 1680, 1980)),
75
+        array(165, 3196, 0, array(630, 1204, 1770, 2100)),
76
+        array(169, 3362, 0, array(660, 1260, 1860, 2220)),
77
+        array(173, 3532, 0, array(720, 1316, 1950, 2310)),
78
+        array(177, 3706, 0, array(750, 1372, 2040, 2430)) //40
79 79
     );
80 80
     
81 81
     //----------------------------------------------------------------------
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
     public static function getMinimumVersion($size, $level)
107 107
     {
108 108
 
109
-        for($i=1; $i<= QRSPEC_VERSION_MAX; $i++) {
110
-            $words  = self::$capacity[$i][QRCAP_WORDS] - self::$capacity[$i][QRCAP_EC][$level];
111
-            if($words >= $size) 
109
+        for ($i = 1; $i <= QRSPEC_VERSION_MAX; $i++) {
110
+            $words = self::$capacity[$i][QRCAP_WORDS] - self::$capacity[$i][QRCAP_EC][$level];
111
+            if ($words >= $size) 
112 112
                 return $i;
113 113
         }
114 114
 
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
     
120 120
     public static $lengthTableBits = array(
121 121
         array(10, 12, 14),
122
-        array( 9, 11, 13),
123
-        array( 8, 16, 16),
124
-        array( 8, 10, 12)
122
+        array(9, 11, 13),
123
+        array(8, 16, 16),
124
+        array(8, 10, 12)
125 125
     );
126 126
     
127 127
     //----------------------------------------------------------------------
@@ -144,12 +144,12 @@  discard block
 block discarded – undo
144 144
     //----------------------------------------------------------------------
145 145
     public static function maximumWords($mode, $version)
146 146
     {
147
-        if($mode == QR_MODE_STRUCTURE) 
147
+        if ($mode == QR_MODE_STRUCTURE) 
148 148
             return 3;
149 149
             
150
-        if($version <= 9) {
150
+        if ($version <= 9) {
151 151
             $l = 0;
152
-        } else if($version <= 26) {
152
+        } else if ($version <= 26) {
153 153
             $l = 1;
154 154
         } else {
155 155
             $l = 2;
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         $bits = self::$lengthTableBits[$mode][$l];
159 159
         $words = (1 << $bits) - 1;
160 160
         
161
-        if($mode == QR_MODE_KANJI) {
161
+        if ($mode == QR_MODE_KANJI) {
162 162
             $words *= 2; // the number of bytes is required
163 163
         }
164 164
 
@@ -170,47 +170,47 @@  discard block
 block discarded – undo
170 170
     // See Table 12-16 (pp.30-36), JIS X0510:2004.
171 171
 
172 172
     public static $eccTable = array(
173
-        array(array( 0,  0), array( 0,  0), array( 0,  0), array( 0,  0)),
174
-        array(array( 1,  0), array( 1,  0), array( 1,  0), array( 1,  0)), // 1
175
-        array(array( 1,  0), array( 1,  0), array( 1,  0), array( 1,  0)),
176
-        array(array( 1,  0), array( 1,  0), array( 2,  0), array( 2,  0)),
177
-        array(array( 1,  0), array( 2,  0), array( 2,  0), array( 4,  0)),
178
-        array(array( 1,  0), array( 2,  0), array( 2,  2), array( 2,  2)), // 5
179
-        array(array( 2,  0), array( 4,  0), array( 4,  0), array( 4,  0)),
180
-        array(array( 2,  0), array( 4,  0), array( 2,  4), array( 4,  1)),
181
-        array(array( 2,  0), array( 2,  2), array( 4,  2), array( 4,  2)),
182
-        array(array( 2,  0), array( 3,  2), array( 4,  4), array( 4,  4)),
183
-        array(array( 2,  2), array( 4,  1), array( 6,  2), array( 6,  2)), //10
184
-        array(array( 4,  0), array( 1,  4), array( 4,  4), array( 3,  8)),
185
-        array(array( 2,  2), array( 6,  2), array( 4,  6), array( 7,  4)),
186
-        array(array( 4,  0), array( 8,  1), array( 8,  4), array(12,  4)),
187
-        array(array( 3,  1), array( 4,  5), array(11,  5), array(11,  5)),
188
-        array(array( 5,  1), array( 5,  5), array( 5,  7), array(11,  7)), //15
189
-        array(array( 5,  1), array( 7,  3), array(15,  2), array( 3, 13)),
190
-        array(array( 1,  5), array(10,  1), array( 1, 15), array( 2, 17)),
191
-        array(array( 5,  1), array( 9,  4), array(17,  1), array( 2, 19)),
192
-        array(array( 3,  4), array( 3, 11), array(17,  4), array( 9, 16)),
193
-        array(array( 3,  5), array( 3, 13), array(15,  5), array(15, 10)), //20
194
-        array(array( 4,  4), array(17,  0), array(17,  6), array(19,  6)),
195
-        array(array( 2,  7), array(17,  0), array( 7, 16), array(34,  0)),
196
-        array(array( 4,  5), array( 4, 14), array(11, 14), array(16, 14)),
197
-        array(array( 6,  4), array( 6, 14), array(11, 16), array(30,  2)),
198
-        array(array( 8,  4), array( 8, 13), array( 7, 22), array(22, 13)), //25
199
-        array(array(10,  2), array(19,  4), array(28,  6), array(33,  4)),
200
-        array(array( 8,  4), array(22,  3), array( 8, 26), array(12, 28)),
201
-        array(array( 3, 10), array( 3, 23), array( 4, 31), array(11, 31)),
202
-        array(array( 7,  7), array(21,  7), array( 1, 37), array(19, 26)),
203
-        array(array( 5, 10), array(19, 10), array(15, 25), array(23, 25)), //30
204
-        array(array(13,  3), array( 2, 29), array(42,  1), array(23, 28)),
205
-        array(array(17,  0), array(10, 23), array(10, 35), array(19, 35)),
206
-        array(array(17,  1), array(14, 21), array(29, 19), array(11, 46)),
207
-        array(array(13,  6), array(14, 23), array(44,  7), array(59,  1)),
208
-        array(array(12,  7), array(12, 26), array(39, 14), array(22, 41)), //35
209
-        array(array( 6, 14), array( 6, 34), array(46, 10), array( 2, 64)),
210
-        array(array(17,  4), array(29, 14), array(49, 10), array(24, 46)),
211
-        array(array( 4, 18), array(13, 32), array(48, 14), array(42, 32)),
212
-        array(array(20,  4), array(40,  7), array(43, 22), array(10, 67)),
213
-        array(array(19,  6), array(18, 31), array(34, 34), array(20, 61)),//40
173
+        array(array(0, 0), array(0, 0), array(0, 0), array(0, 0)),
174
+        array(array(1, 0), array(1, 0), array(1, 0), array(1, 0)), // 1
175
+        array(array(1, 0), array(1, 0), array(1, 0), array(1, 0)),
176
+        array(array(1, 0), array(1, 0), array(2, 0), array(2, 0)),
177
+        array(array(1, 0), array(2, 0), array(2, 0), array(4, 0)),
178
+        array(array(1, 0), array(2, 0), array(2, 2), array(2, 2)), // 5
179
+        array(array(2, 0), array(4, 0), array(4, 0), array(4, 0)),
180
+        array(array(2, 0), array(4, 0), array(2, 4), array(4, 1)),
181
+        array(array(2, 0), array(2, 2), array(4, 2), array(4, 2)),
182
+        array(array(2, 0), array(3, 2), array(4, 4), array(4, 4)),
183
+        array(array(2, 2), array(4, 1), array(6, 2), array(6, 2)), //10
184
+        array(array(4, 0), array(1, 4), array(4, 4), array(3, 8)),
185
+        array(array(2, 2), array(6, 2), array(4, 6), array(7, 4)),
186
+        array(array(4, 0), array(8, 1), array(8, 4), array(12, 4)),
187
+        array(array(3, 1), array(4, 5), array(11, 5), array(11, 5)),
188
+        array(array(5, 1), array(5, 5), array(5, 7), array(11, 7)), //15
189
+        array(array(5, 1), array(7, 3), array(15, 2), array(3, 13)),
190
+        array(array(1, 5), array(10, 1), array(1, 15), array(2, 17)),
191
+        array(array(5, 1), array(9, 4), array(17, 1), array(2, 19)),
192
+        array(array(3, 4), array(3, 11), array(17, 4), array(9, 16)),
193
+        array(array(3, 5), array(3, 13), array(15, 5), array(15, 10)), //20
194
+        array(array(4, 4), array(17, 0), array(17, 6), array(19, 6)),
195
+        array(array(2, 7), array(17, 0), array(7, 16), array(34, 0)),
196
+        array(array(4, 5), array(4, 14), array(11, 14), array(16, 14)),
197
+        array(array(6, 4), array(6, 14), array(11, 16), array(30, 2)),
198
+        array(array(8, 4), array(8, 13), array(7, 22), array(22, 13)), //25
199
+        array(array(10, 2), array(19, 4), array(28, 6), array(33, 4)),
200
+        array(array(8, 4), array(22, 3), array(8, 26), array(12, 28)),
201
+        array(array(3, 10), array(3, 23), array(4, 31), array(11, 31)),
202
+        array(array(7, 7), array(21, 7), array(1, 37), array(19, 26)),
203
+        array(array(5, 10), array(19, 10), array(15, 25), array(23, 25)), //30
204
+        array(array(13, 3), array(2, 29), array(42, 1), array(23, 28)),
205
+        array(array(17, 0), array(10, 23), array(10, 35), array(19, 35)),
206
+        array(array(17, 1), array(14, 21), array(29, 19), array(11, 46)),
207
+        array(array(13, 6), array(14, 23), array(44, 7), array(59, 1)),
208
+        array(array(12, 7), array(12, 26), array(39, 14), array(22, 41)), //35
209
+        array(array(6, 14), array(6, 34), array(46, 10), array(2, 64)),
210
+        array(array(17, 4), array(29, 14), array(49, 10), array(24, 46)),
211
+        array(array(4, 18), array(13, 32), array(48, 14), array(42, 32)),
212
+        array(array(20, 4), array(40, 7), array(43, 22), array(10, 67)),
213
+        array(array(19, 6), array(18, 31), array(34, 34), array(20, 61)), //40
214 214
     );                                                                       
215 215
 
216 216
     //----------------------------------------------------------------------
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
     public static function getEccSpec($version, $level, array &$spec)
220 220
     {
221 221
         if (count($spec) < 5) {
222
-            $spec = array(0,0,0,0,0);
222
+            $spec = array(0, 0, 0, 0, 0);
223 223
         }
224 224
 
225 225
         $b1   = self::$eccTable[$version][$level][0];
@@ -227,16 +227,16 @@  discard block
 block discarded – undo
227 227
         $data = self::getDataLength($version, $level);
228 228
         $ecc  = self::getECCLength($version, $level);
229 229
 
230
-        if($b2 == 0) {
230
+        if ($b2 == 0) {
231 231
             $spec[0] = $b1;
232
-            $spec[1] = (int)($data / $b1);
233
-            $spec[2] = (int)($ecc / $b1);
232
+            $spec[1] = (int) ($data / $b1);
233
+            $spec[2] = (int) ($ecc / $b1);
234 234
             $spec[3] = 0; 
235 235
             $spec[4] = 0;
236 236
         } else {
237 237
             $spec[0] = $b1;
238
-            $spec[1] = (int)($data / ($b1 + $b2));
239
-            $spec[2] = (int)($ecc  / ($b1 + $b2));
238
+            $spec[1] = (int) ($data / ($b1 + $b2));
239
+            $spec[2] = (int) ($ecc / ($b1 + $b2));
240 240
             $spec[3] = $b2;
241 241
             $spec[4] = $spec[1] + 1;
242 242
         }
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
     // See Table 1 in Appendix E (pp.71) of JIS X0510:2004.
253 253
      
254 254
     public static $alignmentPattern = array(      
255
-        array( 0,  0),
256
-        array( 0,  0), array(18,  0), array(22,  0), array(26,  0), array(30,  0), // 1- 5
257
-        array(34,  0), array(22, 38), array(24, 42), array(26, 46), array(28, 50), // 6-10
255
+        array(0, 0),
256
+        array(0, 0), array(18, 0), array(22, 0), array(26, 0), array(30, 0), // 1- 5
257
+        array(34, 0), array(22, 38), array(24, 42), array(26, 46), array(28, 50), // 6-10
258 258
         array(30, 54), array(32, 58), array(34, 62), array(26, 46), array(26, 48), //11-15
259 259
         array(26, 50), array(30, 54), array(30, 56), array(30, 58), array(34, 62), //16-20
260 260
         array(28, 50), array(26, 50), array(30, 54), array(28, 54), array(32, 58), //21-25
@@ -280,28 +280,28 @@  discard block
 block discarded – undo
280 280
             "\xa1\xa1\xa1\xa1\xa1"
281 281
         );                        
282 282
         
283
-        $yStart = $oy-2;         
284
-        $xStart = $ox-2;
283
+        $yStart = $oy - 2;         
284
+        $xStart = $ox - 2;
285 285
         
286
-        for($y=0; $y<5; $y++) {
287
-            QRstr::set($frame, $xStart, $yStart+$y, $finder[$y]);
286
+        for ($y = 0; $y < 5; $y++) {
287
+            QRstr::set($frame, $xStart, $yStart + $y, $finder[$y]);
288 288
         }
289 289
     }
290 290
 
291 291
     //----------------------------------------------------------------------
292 292
     public static function putAlignmentPattern($version, &$frame, $width)
293 293
     {
294
-        if($version < 2)
294
+        if ($version < 2)
295 295
             return;
296 296
 
297 297
         $d = self::$alignmentPattern[$version][1] - self::$alignmentPattern[$version][0];
298
-        if($d < 0) {
298
+        if ($d < 0) {
299 299
             $w = 2;
300 300
         } else {
301
-            $w = (int)(($width - self::$alignmentPattern[$version][0]) / $d + 2);
301
+            $w = (int) (($width - self::$alignmentPattern[$version][0]) / $d + 2);
302 302
         }
303 303
 
304
-        if($w * $w - 3 == 1) {
304
+        if ($w * $w - 3 == 1) {
305 305
             $x = self::$alignmentPattern[$version][0];
306 306
             $y = self::$alignmentPattern[$version][0];
307 307
             self::putAlignmentMarker($frame, $x, $y);
@@ -309,16 +309,16 @@  discard block
 block discarded – undo
309 309
         }
310 310
 
311 311
         $cx = self::$alignmentPattern[$version][0];
312
-        for($x=1; $x<$w - 1; $x++) {
312
+        for ($x = 1; $x < $w - 1; $x++) {
313 313
             self::putAlignmentMarker($frame, 6, $cx);
314
-            self::putAlignmentMarker($frame, $cx,  6);
314
+            self::putAlignmentMarker($frame, $cx, 6);
315 315
             $cx += $d;
316 316
         }
317 317
 
318 318
         $cy = self::$alignmentPattern[$version][0];
319
-        for($y=0; $y<$w-1; $y++) {
319
+        for ($y = 0; $y < $w - 1; $y++) {
320 320
             $cx = self::$alignmentPattern[$version][0];
321
-            for($x=0; $x<$w-1; $x++) {
321
+            for ($x = 0; $x < $w - 1; $x++) {
322 322
                 self::putAlignmentMarker($frame, $cx, $cy);
323 323
                 $cx += $d;
324 324
             }
@@ -344,10 +344,10 @@  discard block
 block discarded – undo
344 344
     //----------------------------------------------------------------------
345 345
     public static function getVersionPattern($version)
346 346
     {
347
-        if($version < 7 || $version > QRSPEC_VERSION_MAX)
347
+        if ($version < 7 || $version > QRSPEC_VERSION_MAX)
348 348
             return 0;
349 349
 
350
-        return self::$versionPattern[$version -7];
350
+        return self::$versionPattern[$version - 7];
351 351
     }
352 352
 
353 353
     // Format information --------------------------------------------------
@@ -362,10 +362,10 @@  discard block
 block discarded – undo
362 362
 
363 363
     public static function getFormatInfo($mask, $level)
364 364
     {
365
-        if($mask < 0 || $mask > 7)
365
+        if ($mask < 0 || $mask > 7)
366 366
             return 0;
367 367
             
368
-        if($level < 0 || $level > 3)
368
+        if ($level < 0 || $level > 3)
369 369
             return 0;                
370 370
 
371 371
         return self::$formatInfo[$level][$mask];
@@ -394,8 +394,8 @@  discard block
 block discarded – undo
394 394
             "\xc1\xc1\xc1\xc1\xc1\xc1\xc1"
395 395
         );                            
396 396
         
397
-        for($y=0; $y<7; $y++) {
398
-            QRstr::set($frame, $ox, $oy+$y, $finder[$y]);
397
+        for ($y = 0; $y < 7; $y++) {
398
+            QRstr::set($frame, $ox, $oy + $y, $finder[$y]);
399 399
         }
400 400
     }
401 401
 
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
     public static function createFrame($version)
404 404
     {
405 405
         $width = self::$capacity[$version][QRCAP_WIDTH];
406
-        $frameLine = str_repeat ("\0", $width);
406
+        $frameLine = str_repeat("\0", $width);
407 407
         $frame = array_fill(0, $width, $frameLine);
408 408
 
409 409
         // Finder pattern
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
         // Separator
415 415
         $yOffset = $width - 7;
416 416
         
417
-        for($y=0; $y<7; $y++) {
417
+        for ($y = 0; $y < 7; $y++) {
418 418
             $frame[$y][7] = "\xc0";
419 419
             $frame[$y][$width - 8] = "\xc0";
420 420
             $frame[$yOffset][7] = "\xc0";
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
         $setPattern = str_repeat("\xc0", 8);
425 425
         
426 426
         QRstr::set($frame, 0, 7, $setPattern);
427
-        QRstr::set($frame, $width-8, 7, $setPattern);
427
+        QRstr::set($frame, $width - 8, 7, $setPattern);
428 428
         QRstr::set($frame, 0, $width - 8, $setPattern);
429 429
     
430 430
         // Format info
@@ -434,38 +434,38 @@  discard block
 block discarded – undo
434 434
         
435 435
         $yOffset = $width - 8;
436 436
 
437
-        for($y=0; $y<8; $y++,$yOffset++) {
437
+        for ($y = 0; $y < 8; $y++, $yOffset++) {
438 438
             $frame[$y][8] = "\x84";
439 439
             $frame[$yOffset][8] = "\x84";
440 440
         }
441 441
 
442 442
         // Timing pattern  
443 443
         
444
-        for($i=1; $i<$width-15; $i++) {
445
-            $frame[6][7+$i] = chr(0x90 | ($i & 1));
446
-            $frame[7+$i][6] = chr(0x90 | ($i & 1));
444
+        for ($i = 1; $i < $width - 15; $i++) {
445
+            $frame[6][7 + $i] = chr(0x90 | ($i & 1));
446
+            $frame[7 + $i][6] = chr(0x90 | ($i & 1));
447 447
         }
448 448
         
449 449
         // Alignment pattern  
450 450
         self::putAlignmentPattern($version, $frame, $width);
451 451
         
452 452
         // Version information 
453
-        if($version >= 7) {
453
+        if ($version >= 7) {
454 454
             $vinf = self::getVersionPattern($version);
455 455
 
456 456
             $v = $vinf;
457 457
             
458
-            for($x=0; $x<6; $x++) {
459
-                for($y=0; $y<3; $y++) {
460
-                    $frame[($width - 11)+$y][$x] = chr(0x88 | ($v & 1));
458
+            for ($x = 0; $x < 6; $x++) {
459
+                for ($y = 0; $y < 3; $y++) {
460
+                    $frame[($width - 11) + $y][$x] = chr(0x88 | ($v & 1));
461 461
                     $v = $v >> 1;
462 462
                 }
463 463
             }
464 464
 
465 465
             $v = $vinf;
466
-            for($y=0; $y<6; $y++) {
467
-                for($x=0; $x<3; $x++) {
468
-                    $frame[$y][$x+($width - 11)] = chr(0x88 | ($v & 1));
466
+            for ($y = 0; $y < 6; $y++) {
467
+                for ($x = 0; $x < 3; $x++) {
468
+                    $frame[$y][$x + ($width - 11)] = chr(0x88 | ($v & 1));
469 469
                     $v = $v >> 1;
470 470
                 }
471 471
             }
@@ -499,16 +499,16 @@  discard block
 block discarded – undo
499 499
         } else {
500 500
         
501 501
             foreach ($frame as &$frameLine) {
502
-                $frameLine = join('<span class="m">&nbsp;</span>',  explode("\xc0", $frameLine));
502
+                $frameLine = join('<span class="m">&nbsp;</span>', explode("\xc0", $frameLine));
503 503
                 $frameLine = join('<span class="m">&#9618;</span>', explode("\xc1", $frameLine));
504
-                $frameLine = join('<span class="p">&nbsp;</span>',  explode("\xa0", $frameLine));
504
+                $frameLine = join('<span class="p">&nbsp;</span>', explode("\xa0", $frameLine));
505 505
                 $frameLine = join('<span class="p">&#9618;</span>', explode("\xa1", $frameLine));
506 506
                 $frameLine = join('<span class="s">&#9671;</span>', explode("\x84", $frameLine)); //format 0
507 507
                 $frameLine = join('<span class="s">&#9670;</span>', explode("\x85", $frameLine)); //format 1
508 508
                 $frameLine = join('<span class="x">&#9762;</span>', explode("\x81", $frameLine)); //special bit
509
-                $frameLine = join('<span class="c">&nbsp;</span>',  explode("\x90", $frameLine)); //clock 0
509
+                $frameLine = join('<span class="c">&nbsp;</span>', explode("\x90", $frameLine)); //clock 0
510 510
                 $frameLine = join('<span class="c">&#9719;</span>', explode("\x91", $frameLine)); //clock 1
511
-                $frameLine = join('<span class="f">&nbsp;</span>',  explode("\x88", $frameLine)); //version
511
+                $frameLine = join('<span class="f">&nbsp;</span>', explode("\x88", $frameLine)); //version
512 512
                 $frameLine = join('<span class="f">&#9618;</span>', explode("\x89", $frameLine)); //version
513 513
                 $frameLine = join('&#9830;', explode("\x01", $frameLine));
514 514
                 $frameLine = join('&#8901;', explode("\0", $frameLine));
@@ -546,10 +546,10 @@  discard block
 block discarded – undo
546 546
     //----------------------------------------------------------------------
547 547
     public static function newFrame($version)
548 548
     {
549
-        if($version < 1 || $version > QRSPEC_VERSION_MAX) 
549
+        if ($version < 1 || $version > QRSPEC_VERSION_MAX) 
550 550
             return null;
551 551
 
552
-        if(!isset(self::$frames[$version])) {
552
+        if (!isset(self::$frames[$version])) {
553 553
             
554 554
             $fileName = QR_CACHE_DIR.'frame_'.$version.'.dat';
555 555
             
@@ -565,21 +565,21 @@  discard block
 block discarded – undo
565 565
             }
566 566
         }
567 567
         
568
-        if(is_null(self::$frames[$version]))
568
+        if (is_null(self::$frames[$version]))
569 569
             return null;
570 570
 
571 571
         return self::$frames[$version];
572 572
     }
573 573
 
574 574
     //----------------------------------------------------------------------
575
-    public static function rsBlockNum($spec)     { return $spec[0] + $spec[3]; }
576
-    public static function rsBlockNum1($spec)    { return $spec[0]; }
577
-    public static function rsDataCodes1($spec)   { return $spec[1]; }
578
-    public static function rsEccCodes1($spec)    { return $spec[2]; }
579
-    public static function rsBlockNum2($spec)    { return $spec[3]; }
580
-    public static function rsDataCodes2($spec)   { return $spec[4]; }
581
-    public static function rsEccCodes2($spec)    { return $spec[2]; }
582
-    public static function rsDataLength($spec)   { return ($spec[0] * $spec[1]) + ($spec[3] * $spec[4]);    }
583
-    public static function rsEccLength($spec)    { return ($spec[0] + $spec[3]) * $spec[2]; }
575
+    public static function rsBlockNum($spec) { return $spec[0] + $spec[3]; }
576
+    public static function rsBlockNum1($spec) { return $spec[0]; }
577
+    public static function rsDataCodes1($spec) { return $spec[1]; }
578
+    public static function rsEccCodes1($spec) { return $spec[2]; }
579
+    public static function rsBlockNum2($spec) { return $spec[3]; }
580
+    public static function rsDataCodes2($spec) { return $spec[4]; }
581
+    public static function rsEccCodes2($spec) { return $spec[2]; }
582
+    public static function rsDataLength($spec) { return ($spec[0] * $spec[1]) + ($spec[3] * $spec[4]); }
583
+    public static function rsEccLength($spec) { return ($spec[0] + $spec[3]) * $spec[2]; }
584 584
     
585 585
 }
586 586
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +27 added lines, -18 removed lines patch added patch discarded remove patch
@@ -108,8 +108,9 @@  discard block
 block discarded – undo
108 108
 
109 109
         for($i=1; $i<= QRSPEC_VERSION_MAX; $i++) {
110 110
             $words  = self::$capacity[$i][QRCAP_WORDS] - self::$capacity[$i][QRCAP_EC][$level];
111
-            if($words >= $size) 
112
-                return $i;
111
+            if($words >= $size) {
112
+                            return $i;
113
+            }
113 114
         }
114 115
 
115 116
         return -1;
@@ -127,8 +128,9 @@  discard block
 block discarded – undo
127 128
     //----------------------------------------------------------------------
128 129
     public static function lengthIndicator($mode, $version)
129 130
     {
130
-        if ($mode == QR_MODE_STRUCTURE)
131
-            return 0;
131
+        if ($mode == QR_MODE_STRUCTURE) {
132
+                    return 0;
133
+        }
132 134
             
133 135
         if ($version <= 9) {
134 136
             $l = 0;
@@ -144,8 +146,9 @@  discard block
 block discarded – undo
144 146
     //----------------------------------------------------------------------
145 147
     public static function maximumWords($mode, $version)
146 148
     {
147
-        if($mode == QR_MODE_STRUCTURE) 
148
-            return 3;
149
+        if($mode == QR_MODE_STRUCTURE) {
150
+                    return 3;
151
+        }
149 152
             
150 153
         if($version <= 9) {
151 154
             $l = 0;
@@ -291,8 +294,9 @@  discard block
 block discarded – undo
291 294
     //----------------------------------------------------------------------
292 295
     public static function putAlignmentPattern($version, &$frame, $width)
293 296
     {
294
-        if($version < 2)
295
-            return;
297
+        if($version < 2) {
298
+                    return;
299
+        }
296 300
 
297 301
         $d = self::$alignmentPattern[$version][1] - self::$alignmentPattern[$version][0];
298 302
         if($d < 0) {
@@ -344,8 +348,9 @@  discard block
 block discarded – undo
344 348
     //----------------------------------------------------------------------
345 349
     public static function getVersionPattern($version)
346 350
     {
347
-        if($version < 7 || $version > QRSPEC_VERSION_MAX)
348
-            return 0;
351
+        if($version < 7 || $version > QRSPEC_VERSION_MAX) {
352
+                    return 0;
353
+        }
349 354
 
350 355
         return self::$versionPattern[$version -7];
351 356
     }
@@ -362,11 +367,13 @@  discard block
 block discarded – undo
362 367
 
363 368
     public static function getFormatInfo($mask, $level)
364 369
     {
365
-        if($mask < 0 || $mask > 7)
366
-            return 0;
370
+        if($mask < 0 || $mask > 7) {
371
+                    return 0;
372
+        }
367 373
             
368
-        if($level < 0 || $level > 3)
369
-            return 0;                
374
+        if($level < 0 || $level > 3) {
375
+                    return 0;
376
+        }
370 377
 
371 378
         return self::$formatInfo[$level][$mask];
372 379
     }
@@ -546,8 +553,9 @@  discard block
 block discarded – undo
546 553
     //----------------------------------------------------------------------
547 554
     public static function newFrame($version)
548 555
     {
549
-        if($version < 1 || $version > QRSPEC_VERSION_MAX) 
550
-            return null;
556
+        if($version < 1 || $version > QRSPEC_VERSION_MAX) {
557
+                    return null;
558
+        }
551 559
 
552 560
         if(!isset(self::$frames[$version])) {
553 561
             
@@ -565,8 +573,9 @@  discard block
 block discarded – undo
565 573
             }
566 574
         }
567 575
         
568
-        if(is_null(self::$frames[$version]))
569
-            return null;
576
+        if(is_null(self::$frames[$version])) {
577
+                    return null;
578
+        }
570 579
 
571 580
         return self::$frames[$version];
572 581
     }
Please login to merge, or discard this patch.
src/Gateways/qrcode/QRstr.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,6 +10,6 @@
 block discarded – undo
10 10
 class QRstr
11 11
 {
12 12
     public static function set(&$srctab, $x, $y, $repl, $replLen = false) {
13
-        $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl));
13
+        $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false) ?substr($repl, 0, $replLen) : $repl, $x, ($replLen !== false) ? $replLen : strlen($repl));
14 14
     }
15 15
 }
16 16
\ No newline at end of file
Please login to merge, or discard this patch.
src/Gateways/qrcode/QRbitstream.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
         $bstream->allocate($bits);
52 52
         
53 53
         $mask = 1 << ($bits - 1);
54
-        for($i=0; $i<$bits; $i++) {
55
-            if($num & $mask) {
54
+        for ($i = 0; $i < $bits; $i++) {
55
+            if ($num & $mask) {
56 56
                 $bstream->data[$i] = 1;
57 57
             } else {
58 58
                 $bstream->data[$i] = 0;
@@ -68,12 +68,12 @@  discard block
 block discarded – undo
68 68
     {
69 69
         $bstream = new QRbitstream();
70 70
         $bstream->allocate($size * 8);
71
-        $p=0;
71
+        $p = 0;
72 72
 
73
-        for($i=0; $i<$size; $i++) {
73
+        for ($i = 0; $i < $size; $i++) {
74 74
             $mask = 0x80;
75
-            for($j=0; $j<8; $j++) {
76
-                if($data[$i] & $mask) {
75
+            for ($j = 0; $j < 8; $j++) {
76
+                if ($data[$i] & $mask) {
77 77
                     $bstream->data[$p] = 1;
78 78
                 } else {
79 79
                     $bstream->data[$p] = 0;
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
             return -1;
94 94
         }
95 95
         
96
-        if($arg->size() == 0) {
96
+        if ($arg->size() == 0) {
97 97
             return 0;
98 98
         }
99 99
         
100
-        if($this->size() == 0) {
100
+        if ($this->size() == 0) {
101 101
             $this->data = $arg->data;
102 102
             return 0;
103 103
         }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
         $b = QRbitstream::newFromNum($bits, $num);
117 117
         
118
-        if(is_null($b))
118
+        if (is_null($b))
119 119
             return -1;
120 120
 
121 121
         $ret = $this->append($b);
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
         $b = QRbitstream::newFromBytes($size, $data);
134 134
         
135
-        if(is_null($b))
135
+        if (is_null($b))
136 136
             return -1;
137 137
 
138 138
         $ret = $this->append($b);
@@ -147,18 +147,18 @@  discard block
 block discarded – undo
147 147
     
148 148
         $size = $this->size();
149 149
 
150
-        if($size == 0) {
150
+        if ($size == 0) {
151 151
             return array();
152 152
         }
153 153
         
154
-        $data = array_fill(0, (int)(($size + 7) / 8), 0);
155
-        $bytes = (int)($size / 8);
154
+        $data = array_fill(0, (int) (($size + 7) / 8), 0);
155
+        $bytes = (int) ($size / 8);
156 156
 
157 157
         $p = 0;
158 158
         
159
-        for($i=0; $i<$bytes; $i++) {
159
+        for ($i = 0; $i < $bytes; $i++) {
160 160
             $v = 0;
161
-            for($j=0; $j<8; $j++) {
161
+            for ($j = 0; $j < 8; $j++) {
162 162
                 $v = $v << 1;
163 163
                 $v |= $this->data[$p];
164 164
                 $p++;
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
             $data[$i] = $v;
167 167
         }
168 168
         
169
-        if($size & 7) {
169
+        if ($size & 7) {
170 170
             $v = 0;
171
-            for($j=0; $j<($size & 7); $j++) {
171
+            for ($j = 0; $j < ($size & 7); $j++) {
172 172
                 $v = $v << 1;
173 173
                 $v |= $this->data[$p];
174 174
                 $p++;
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -110,13 +110,15 @@  discard block
 block discarded – undo
110 110
     //----------------------------------------------------------------------
111 111
     public function appendNum($bits, $num)
112 112
     {
113
-        if ($bits == 0) 
114
-            return 0;
113
+        if ($bits == 0) {
114
+                    return 0;
115
+        }
115 116
 
116 117
         $b = QRbitstream::newFromNum($bits, $num);
117 118
         
118
-        if(is_null($b))
119
-            return -1;
119
+        if(is_null($b)) {
120
+                    return -1;
121
+        }
120 122
 
121 123
         $ret = $this->append($b);
122 124
         unset($b);
@@ -127,13 +129,15 @@  discard block
 block discarded – undo
127 129
     //----------------------------------------------------------------------
128 130
     public function appendBytes($size, $data)
129 131
     {
130
-        if ($size == 0) 
131
-            return 0;
132
+        if ($size == 0) {
133
+                    return 0;
134
+        }
132 135
 
133 136
         $b = QRbitstream::newFromBytes($size, $data);
134 137
         
135
-        if(is_null($b))
136
-            return -1;
138
+        if(is_null($b)) {
139
+                    return -1;
140
+        }
137 141
 
138 142
         $ret = $this->append($b);
139 143
         unset($b);
Please login to merge, or discard this patch.
src/Gateways/qrcode/QRencode.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     {
81 81
         $code = new Qrcode();
82 82
 
83
-        if($this->eightbit) {
83
+        if ($this->eightbit) {
84 84
             $code->encodeString8bit($intext, $this->version, $this->level);
85 85
         } else {
86 86
             $code->encodeString($intext, $this->version, $this->level, $this->hint, $this->casesensitive);
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     {
95 95
         $code = new Qrcode();
96 96
 
97
-        if($this->eightbit) {
97
+        if ($this->eightbit) {
98 98
             $code->encodeString8bit($intext, $this->version, $this->level);
99 99
         } else {
100 100
             $code->encodeString($intext, $this->version, $this->level, $this->hint, $this->casesensitive);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         
103 103
         QRtools::markTime('after_encode');
104 104
         
105
-        if ($outfile!== false) {
105
+        if ($outfile !== false) {
106 106
             file_put_contents($outfile, join("\n", QRtools::binarize($code->data)));
107 107
         } else {
108 108
             return QRtools::binarize($code->data);
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     }
111 111
     
112 112
     //----------------------------------------------------------------------
113
-    public function encodePNG($intext, $outfile = false,$saveandprint=false) 
113
+    public function encodePNG($intext, $outfile = false, $saveandprint = false) 
114 114
     {
115 115
         try {
116 116
         
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
             if ($err != '')
123 123
                 QRtools::log($outfile, $err);
124 124
             
125
-            $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
125
+            $maxSize = (int) (QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin));
126 126
             
127
-            QRimage::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint);
127
+            QRimage::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin, $saveandprint);
128 128
         
129 129
         } catch (Exception $e) {
130 130
         
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,8 +119,9 @@
 block discarded – undo
119 119
             $err = ob_get_contents();
120 120
             ob_end_clean();
121 121
             
122
-            if ($err != '')
123
-                QRtools::log($outfile, $err);
122
+            if ($err != '') {
123
+                            QRtools::log($outfile, $err);
124
+            }
124 125
             
125 126
             $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
126 127
             
Please login to merge, or discard this patch.
src/Gateways/Bar.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 use tinymeng\code\Gateways\barcode\BCGcode128;
11 11
 use tinymeng\code\Gateways\barcode\BCGDrawing;
12 12
 
13
-class Bar extends Gateway{
13
+class Bar extends Gateway {
14 14
 
15 15
     /**
16 16
      * Function Name: create
@@ -24,27 +24,27 @@  discard block
 block discarded – undo
24 24
      * @author Tinymeng <[email protected]>
25 25
      * @date: 2019/9/27 11:28
26 26
      */
27
-    public function create($data,$showfront=false,$filePath=false,$size=2,$height=20){
28
-        if (trim($data) == ''){
27
+    public function create($data, $showfront = false, $filePath = false, $size = 2, $height = 20) {
28
+        if (trim($data) == '') {
29 29
             throw new Exception('data 不能为空!');
30 30
         }
31 31
 
32 32
         $colorFront = new BCGColor(0, 0, 0);
33 33
         $colorBack = new BCGColor(255, 255, 255);
34 34
         $code = new BCGcode128();
35
-        $code->setScale($size);//大小
36
-        $code->setThickness($height);//高度
37
-        if($showfront === false){
38
-            $code->setFont(0);//是否显示数字
35
+        $code->setScale($size); //大小
36
+        $code->setThickness($height); //高度
37
+        if ($showfront === false) {
38
+            $code->setFont(0); //是否显示数字
39 39
         }
40 40
         $code->setColor($colorFront, $colorBack);
41 41
         $code->parse($data);
42 42
 
43
-        if($filePath){
44
-            if($filePath === true){
43
+        if ($filePath) {
44
+            if ($filePath === true) {
45 45
                 $filePath = saveFilePath;
46
-            }else{
47
-                if(substr($filePath,-1) != DIRECTORY_SEPARATOR){
46
+            } else {
47
+                if (substr($filePath, -1) != DIRECTORY_SEPARATOR) {
48 48
                     $filePath .= DIRECTORY_SEPARATOR;
49 49
                 }
50 50
             }
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
                 mkdir($filePath, 0777, true);
54 54
             }
55 55
 
56
-            if(is_int($data)){
56
+            if (is_int($data)) {
57 57
                 $file_name = 'bar'.$data.'.png';
58
-            }else{
59
-                $file_name = 'bar'.date('YmdHis').rand(1111,9999).'.png';
58
+            } else {
59
+                $file_name = 'bar'.date('YmdHis').rand(1111, 9999).'.png';
60 60
             }
61 61
             $filename = $filePath.$file_name.'.png';
62 62
             $drawing = new BCGDrawing($filename, $colorBack);
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             $drawing->draw();
65 65
             $drawing->finish(BCGDrawing::IMG_FORMAT_PNG);
66 66
             return $filename;
67
-        }else{
67
+        } else {
68 68
             $drawing = new BCGDrawing(false, $colorBack);
69 69
             $drawing->setBarcode($code);
70 70
             $drawing->draw();
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         if($filePath){
44 44
             if($filePath === true){
45 45
                 $filePath = saveFilePath;
46
-            }else{
46
+            } else{
47 47
                 if(substr($filePath,-1) != DIRECTORY_SEPARATOR){
48 48
                     $filePath .= DIRECTORY_SEPARATOR;
49 49
                 }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
             if(is_int($data)){
57 57
                 $file_name = 'bar'.$data.'.png';
58
-            }else{
58
+            } else{
59 59
                 $file_name = 'bar'.date('YmdHis').rand(1111,9999).'.png';
60 60
             }
61 61
             $filename = $filePath.$file_name.'.png';
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             $drawing->draw();
65 65
             $drawing->finish(BCGDrawing::IMG_FORMAT_PNG);
66 66
             return $filename;
67
-        }else{
67
+        } else{
68 68
             $drawing = new BCGDrawing(false, $colorBack);
69 69
             $drawing->setBarcode($code);
70 70
             $drawing->draw();
Please login to merge, or discard this patch.
src/Connector/Gateway.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
      * @author Tinymeng <[email protected]>
43 43
      * @date: 2019/9/26 10:44
44 44
      */
45
-    public function setDebug($debug){
45
+    public function setDebug($debug) {
46 46
         $this->debug = $debug;
47 47
     }
48 48
 
Please login to merge, or discard this patch.
src/Generate.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @method static \tinymeng\code\Gateways\Qr qr(array $config=[]) 二维码
11 11
  * @package tinymeng\mailer
12 12
  */
13
-define('saveFilePath',dirname(dirname(dirname(dirname(__DIR__)))).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.'tinymeng'.DIRECTORY_SEPARATOR.'code'.DIRECTORY_SEPARATOR);
13
+define('saveFilePath', dirname(dirname(dirname(dirname(__DIR__)))).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.'tinymeng'.DIRECTORY_SEPARATOR.'code'.DIRECTORY_SEPARATOR);
14 14
 
15 15
 class Generate
16 16
 {
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     protected static function init($gateway, $config = null)
27 27
     {
28
-        $class = __NAMESPACE__ . '\\Gateways\\' . StringTool::uFirst($gateway);
28
+        $class = __NAMESPACE__.'\\Gateways\\'.StringTool::uFirst($gateway);
29 29
         if (class_exists($class)) {
30 30
             $app = new $class($config);
31 31
             return $app;
Please login to merge, or discard this patch.