@@ -53,7 +53,7 @@ |
||
53 | 53 | $dataBytes[$key] = []; |
54 | 54 | |
55 | 55 | for($i = 0; $i < $dataByteCount; $i++){ |
56 | - $dataBytes[$key][$i] = $bitBufferData[$i + $dataByteOffset] & 0xff; |
|
56 | + $dataBytes[$key][$i] = $bitBufferData[$i + $dataByteOffset]&0xff; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | $ecByteCount = $rsBlockTotal - $dataByteCount; |
@@ -38,7 +38,7 @@ |
||
38 | 38 | |
39 | 39 | private const logTable = [ |
40 | 40 | 0, // the first value is never returned, index starts at 1 |
41 | - 0, 1, 25, 2, 50, 26, 198, 3, 223, 51, 238, 27, 104, 199, 75, |
|
41 | + 0, 1, 25, 2, 50, 26, 198, 3, 223, 51, 238, 27, 104, 199, 75, |
|
42 | 42 | 4, 100, 224, 14, 52, 141, 239, 129, 28, 193, 105, 248, 200, 8, 76, 113, |
43 | 43 | 5, 138, 101, 47, 225, 36, 15, 33, 53, 147, 142, 218, 240, 18, 130, 69, |
44 | 44 | 29, 181, 194, 125, 106, 39, 249, 185, 201, 154, 9, 120, 77, 228, 114, 166, |
@@ -38,41 +38,41 @@ discard block |
||
38 | 38 | |
39 | 39 | private const logTable = [ |
40 | 40 | 0, // the first value is never returned, index starts at 1 |
41 | - 0, 1, 25, 2, 50, 26, 198, 3, 223, 51, 238, 27, 104, 199, 75, |
|
42 | - 4, 100, 224, 14, 52, 141, 239, 129, 28, 193, 105, 248, 200, 8, 76, 113, |
|
43 | - 5, 138, 101, 47, 225, 36, 15, 33, 53, 147, 142, 218, 240, 18, 130, 69, |
|
44 | - 29, 181, 194, 125, 106, 39, 249, 185, 201, 154, 9, 120, 77, 228, 114, 166, |
|
45 | - 6, 191, 139, 98, 102, 221, 48, 253, 226, 152, 37, 179, 16, 145, 34, 136, |
|
46 | - 54, 208, 148, 206, 143, 150, 219, 189, 241, 210, 19, 92, 131, 56, 70, 64, |
|
47 | - 30, 66, 182, 163, 195, 72, 126, 110, 107, 58, 40, 84, 250, 133, 186, 61, |
|
48 | - 202, 94, 155, 159, 10, 21, 121, 43, 78, 212, 229, 172, 115, 243, 167, 87, |
|
49 | - 7, 112, 192, 247, 140, 128, 99, 13, 103, 74, 222, 237, 49, 197, 254, 24, |
|
50 | - 227, 165, 153, 119, 38, 184, 180, 124, 17, 68, 146, 217, 35, 32, 137, 46, |
|
51 | - 55, 63, 209, 91, 149, 188, 207, 205, 144, 135, 151, 178, 220, 252, 190, 97, |
|
52 | - 242, 86, 211, 171, 20, 42, 93, 158, 132, 60, 57, 83, 71, 109, 65, 162, |
|
53 | - 31, 45, 67, 216, 183, 123, 164, 118, 196, 23, 73, 236, 127, 12, 111, 246, |
|
54 | - 108, 161, 59, 82, 41, 157, 85, 170, 251, 96, 134, 177, 187, 204, 62, 90, |
|
55 | - 203, 89, 95, 176, 156, 169, 160, 81, 11, 245, 22, 235, 122, 117, 44, 215, |
|
56 | - 79, 174, 213, 233, 230, 231, 173, 232, 116, 214, 244, 234, 168, 80, 88, 175, |
|
41 | + 0, 1, 25, 2, 50, 26, 198, 3, 223, 51, 238, 27, 104, 199, 75, |
|
42 | + 4, 100, 224, 14, 52, 141, 239, 129, 28, 193, 105, 248, 200, 8, 76, 113, |
|
43 | + 5, 138, 101, 47, 225, 36, 15, 33, 53, 147, 142, 218, 240, 18, 130, 69, |
|
44 | + 29, 181, 194, 125, 106, 39, 249, 185, 201, 154, 9, 120, 77, 228, 114, 166, |
|
45 | + 6, 191, 139, 98, 102, 221, 48, 253, 226, 152, 37, 179, 16, 145, 34, 136, |
|
46 | + 54, 208, 148, 206, 143, 150, 219, 189, 241, 210, 19, 92, 131, 56, 70, 64, |
|
47 | + 30, 66, 182, 163, 195, 72, 126, 110, 107, 58, 40, 84, 250, 133, 186, 61, |
|
48 | + 202, 94, 155, 159, 10, 21, 121, 43, 78, 212, 229, 172, 115, 243, 167, 87, |
|
49 | + 7, 112, 192, 247, 140, 128, 99, 13, 103, 74, 222, 237, 49, 197, 254, 24, |
|
50 | + 227, 165, 153, 119, 38, 184, 180, 124, 17, 68, 146, 217, 35, 32, 137, 46, |
|
51 | + 55, 63, 209, 91, 149, 188, 207, 205, 144, 135, 151, 178, 220, 252, 190, 97, |
|
52 | + 242, 86, 211, 171, 20, 42, 93, 158, 132, 60, 57, 83, 71, 109, 65, 162, |
|
53 | + 31, 45, 67, 216, 183, 123, 164, 118, 196, 23, 73, 236, 127, 12, 111, 246, |
|
54 | + 108, 161, 59, 82, 41, 157, 85, 170, 251, 96, 134, 177, 187, 204, 62, 90, |
|
55 | + 203, 89, 95, 176, 156, 169, 160, 81, 11, 245, 22, 235, 122, 117, 44, 215, |
|
56 | + 79, 174, 213, 233, 230, 231, 173, 232, 116, 214, 244, 234, 168, 80, 88, 175, |
|
57 | 57 | ]; |
58 | 58 | |
59 | 59 | private const expTable = [ |
60 | - 1, 2, 4, 8, 16, 32, 64, 128, 29, 58, 116, 232, 205, 135, 19, 38, |
|
61 | - 76, 152, 45, 90, 180, 117, 234, 201, 143, 3, 6, 12, 24, 48, 96, 192, |
|
62 | - 157, 39, 78, 156, 37, 74, 148, 53, 106, 212, 181, 119, 238, 193, 159, 35, |
|
63 | - 70, 140, 5, 10, 20, 40, 80, 160, 93, 186, 105, 210, 185, 111, 222, 161, |
|
64 | - 95, 190, 97, 194, 153, 47, 94, 188, 101, 202, 137, 15, 30, 60, 120, 240, |
|
65 | - 253, 231, 211, 187, 107, 214, 177, 127, 254, 225, 223, 163, 91, 182, 113, 226, |
|
66 | - 217, 175, 67, 134, 17, 34, 68, 136, 13, 26, 52, 104, 208, 189, 103, 206, |
|
67 | - 129, 31, 62, 124, 248, 237, 199, 147, 59, 118, 236, 197, 151, 51, 102, 204, |
|
68 | - 133, 23, 46, 92, 184, 109, 218, 169, 79, 158, 33, 66, 132, 21, 42, 84, |
|
69 | - 168, 77, 154, 41, 82, 164, 85, 170, 73, 146, 57, 114, 228, 213, 183, 115, |
|
70 | - 230, 209, 191, 99, 198, 145, 63, 126, 252, 229, 215, 179, 123, 246, 241, 255, |
|
71 | - 227, 219, 171, 75, 150, 49, 98, 196, 149, 55, 110, 220, 165, 87, 174, 65, |
|
72 | - 130, 25, 50, 100, 200, 141, 7, 14, 28, 56, 112, 224, 221, 167, 83, 166, |
|
73 | - 81, 162, 89, 178, 121, 242, 249, 239, 195, 155, 43, 86, 172, 69, 138, 9, |
|
74 | - 18, 36, 72, 144, 61, 122, 244, 245, 247, 243, 251, 235, 203, 139, 11, 22, |
|
75 | - 44, 88, 176, 125, 250, 233, 207, 131, 27, 54, 108, 216, 173, 71, 142, 1, |
|
60 | + 1, 2, 4, 8, 16, 32, 64, 128, 29, 58, 116, 232, 205, 135, 19, 38, |
|
61 | + 76, 152, 45, 90, 180, 117, 234, 201, 143, 3, 6, 12, 24, 48, 96, 192, |
|
62 | + 157, 39, 78, 156, 37, 74, 148, 53, 106, 212, 181, 119, 238, 193, 159, 35, |
|
63 | + 70, 140, 5, 10, 20, 40, 80, 160, 93, 186, 105, 210, 185, 111, 222, 161, |
|
64 | + 95, 190, 97, 194, 153, 47, 94, 188, 101, 202, 137, 15, 30, 60, 120, 240, |
|
65 | + 253, 231, 211, 187, 107, 214, 177, 127, 254, 225, 223, 163, 91, 182, 113, 226, |
|
66 | + 217, 175, 67, 134, 17, 34, 68, 136, 13, 26, 52, 104, 208, 189, 103, 206, |
|
67 | + 129, 31, 62, 124, 248, 237, 199, 147, 59, 118, 236, 197, 151, 51, 102, 204, |
|
68 | + 133, 23, 46, 92, 184, 109, 218, 169, 79, 158, 33, 66, 132, 21, 42, 84, |
|
69 | + 168, 77, 154, 41, 82, 164, 85, 170, 73, 146, 57, 114, 228, 213, 183, 115, |
|
70 | + 230, 209, 191, 99, 198, 145, 63, 126, 252, 229, 215, 179, 123, 246, 241, 255, |
|
71 | + 227, 219, 171, 75, 150, 49, 98, 196, 149, 55, 110, 220, 165, 87, 174, 65, |
|
72 | + 130, 25, 50, 100, 200, 141, 7, 14, 28, 56, 112, 224, 221, 167, 83, 166, |
|
73 | + 81, 162, 89, 178, 121, 242, 249, 239, 195, 155, 43, 86, 172, 69, 138, 9, |
|
74 | + 18, 36, 72, 144, 61, 122, 244, 245, 247, 243, 251, 235, 203, 139, 11, 22, |
|
75 | + 44, 88, 176, 125, 250, 233, 207, 131, 27, 54, 108, 216, 173, 71, 142, 1, |
|
76 | 76 | ]; |
77 | 77 | |
78 | 78 | /** |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @return int sum/difference of a and b |
82 | 82 | */ |
83 | 83 | public static function addOrSubtract(int $a, int $b):int{ |
84 | - return $a ^ $b; |
|
84 | + return $a^$b; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -33,15 +33,15 @@ |
||
33 | 33 | QRMatrix::M_LOGO => false, |
34 | 34 | QRMatrix::M_TEST => false, |
35 | 35 | // dark |
36 | - QRMatrix::M_DARKMODULE | QRMatrix::IS_DARK => true, |
|
37 | - QRMatrix::M_DATA | QRMatrix::IS_DARK => true, |
|
38 | - QRMatrix::M_FINDER | QRMatrix::IS_DARK => true, |
|
39 | - QRMatrix::M_ALIGNMENT | QRMatrix::IS_DARK => true, |
|
40 | - QRMatrix::M_TIMING | QRMatrix::IS_DARK => true, |
|
41 | - QRMatrix::M_FORMAT | QRMatrix::IS_DARK => true, |
|
42 | - QRMatrix::M_VERSION | QRMatrix::IS_DARK => true, |
|
43 | - QRMatrix::M_FINDER_DOT | QRMatrix::IS_DARK => true, |
|
44 | - QRMatrix::M_TEST | QRMatrix::IS_DARK => true, |
|
36 | + QRMatrix::M_DARKMODULE|QRMatrix::IS_DARK => true, |
|
37 | + QRMatrix::M_DATA|QRMatrix::IS_DARK => true, |
|
38 | + QRMatrix::M_FINDER|QRMatrix::IS_DARK => true, |
|
39 | + QRMatrix::M_ALIGNMENT|QRMatrix::IS_DARK => true, |
|
40 | + QRMatrix::M_TIMING|QRMatrix::IS_DARK => true, |
|
41 | + QRMatrix::M_FORMAT|QRMatrix::IS_DARK => true, |
|
42 | + QRMatrix::M_VERSION|QRMatrix::IS_DARK => true, |
|
43 | + QRMatrix::M_FINDER_DOT|QRMatrix::IS_DARK => true, |
|
44 | + QRMatrix::M_TEST|QRMatrix::IS_DARK => true, |
|
45 | 45 | ]; |
46 | 46 | |
47 | 47 | /** |
@@ -62,45 +62,45 @@ discard block |
||
62 | 62 | */ |
63 | 63 | private const MAX_BITS = [ |
64 | 64 | // v => [ L, M, Q, H] // modules |
65 | - 1 => [ 152, 128, 104, 72], // 21 |
|
66 | - 2 => [ 272, 224, 176, 128], // 25 |
|
67 | - 3 => [ 440, 352, 272, 208], // 29 |
|
68 | - 4 => [ 640, 512, 384, 288], // 33 |
|
69 | - 5 => [ 864, 688, 496, 368], // 37 |
|
70 | - 6 => [ 1088, 864, 608, 480], // 41 |
|
71 | - 7 => [ 1248, 992, 704, 528], // 45 |
|
72 | - 8 => [ 1552, 1232, 880, 688], // 49 |
|
73 | - 9 => [ 1856, 1456, 1056, 800], // 53 |
|
74 | - 10 => [ 2192, 1728, 1232, 976], // 57 |
|
75 | - 11 => [ 2592, 2032, 1440, 1120], // 61 |
|
76 | - 12 => [ 2960, 2320, 1648, 1264], // 65 |
|
77 | - 13 => [ 3424, 2672, 1952, 1440], // 69 NICE! |
|
78 | - 14 => [ 3688, 2920, 2088, 1576], // 73 |
|
79 | - 15 => [ 4184, 3320, 2360, 1784], // 77 |
|
80 | - 16 => [ 4712, 3624, 2600, 2024], // 81 |
|
81 | - 17 => [ 5176, 4056, 2936, 2264], // 85 |
|
82 | - 18 => [ 5768, 4504, 3176, 2504], // 89 |
|
83 | - 19 => [ 6360, 5016, 3560, 2728], // 93 |
|
84 | - 20 => [ 6888, 5352, 3880, 3080], // 97 |
|
85 | - 21 => [ 7456, 5712, 4096, 3248], // 101 |
|
86 | - 22 => [ 8048, 6256, 4544, 3536], // 105 |
|
87 | - 23 => [ 8752, 6880, 4912, 3712], // 109 |
|
88 | - 24 => [ 9392, 7312, 5312, 4112], // 113 |
|
89 | - 25 => [10208, 8000, 5744, 4304], // 117 |
|
90 | - 26 => [10960, 8496, 6032, 4768], // 121 |
|
91 | - 27 => [11744, 9024, 6464, 5024], // 125 |
|
92 | - 28 => [12248, 9544, 6968, 5288], // 129 |
|
93 | - 29 => [13048, 10136, 7288, 5608], // 133 |
|
94 | - 30 => [13880, 10984, 7880, 5960], // 137 |
|
95 | - 31 => [14744, 11640, 8264, 6344], // 141 |
|
96 | - 32 => [15640, 12328, 8920, 6760], // 145 |
|
97 | - 33 => [16568, 13048, 9368, 7208], // 149 |
|
98 | - 34 => [17528, 13800, 9848, 7688], // 153 |
|
99 | - 35 => [18448, 14496, 10288, 7888], // 157 |
|
100 | - 36 => [19472, 15312, 10832, 8432], // 161 |
|
101 | - 37 => [20528, 15936, 11408, 8768], // 165 |
|
102 | - 38 => [21616, 16816, 12016, 9136], // 169 |
|
103 | - 39 => [22496, 17728, 12656, 9776], // 173 |
|
65 | + 1 => [152, 128, 104, 72], // 21 |
|
66 | + 2 => [272, 224, 176, 128], // 25 |
|
67 | + 3 => [440, 352, 272, 208], // 29 |
|
68 | + 4 => [640, 512, 384, 288], // 33 |
|
69 | + 5 => [864, 688, 496, 368], // 37 |
|
70 | + 6 => [1088, 864, 608, 480], // 41 |
|
71 | + 7 => [1248, 992, 704, 528], // 45 |
|
72 | + 8 => [1552, 1232, 880, 688], // 49 |
|
73 | + 9 => [1856, 1456, 1056, 800], // 53 |
|
74 | + 10 => [2192, 1728, 1232, 976], // 57 |
|
75 | + 11 => [2592, 2032, 1440, 1120], // 61 |
|
76 | + 12 => [2960, 2320, 1648, 1264], // 65 |
|
77 | + 13 => [3424, 2672, 1952, 1440], // 69 NICE! |
|
78 | + 14 => [3688, 2920, 2088, 1576], // 73 |
|
79 | + 15 => [4184, 3320, 2360, 1784], // 77 |
|
80 | + 16 => [4712, 3624, 2600, 2024], // 81 |
|
81 | + 17 => [5176, 4056, 2936, 2264], // 85 |
|
82 | + 18 => [5768, 4504, 3176, 2504], // 89 |
|
83 | + 19 => [6360, 5016, 3560, 2728], // 93 |
|
84 | + 20 => [6888, 5352, 3880, 3080], // 97 |
|
85 | + 21 => [7456, 5712, 4096, 3248], // 101 |
|
86 | + 22 => [8048, 6256, 4544, 3536], // 105 |
|
87 | + 23 => [8752, 6880, 4912, 3712], // 109 |
|
88 | + 24 => [9392, 7312, 5312, 4112], // 113 |
|
89 | + 25 => [10208, 8000, 5744, 4304], // 117 |
|
90 | + 26 => [10960, 8496, 6032, 4768], // 121 |
|
91 | + 27 => [11744, 9024, 6464, 5024], // 125 |
|
92 | + 28 => [12248, 9544, 6968, 5288], // 129 |
|
93 | + 29 => [13048, 10136, 7288, 5608], // 133 |
|
94 | + 30 => [13880, 10984, 7880, 5960], // 137 |
|
95 | + 31 => [14744, 11640, 8264, 6344], // 141 |
|
96 | + 32 => [15640, 12328, 8920, 6760], // 145 |
|
97 | + 33 => [16568, 13048, 9368, 7208], // 149 |
|
98 | + 34 => [17528, 13800, 9848, 7688], // 153 |
|
99 | + 35 => [18448, 14496, 10288, 7888], // 157 |
|
100 | + 36 => [19472, 15312, 10832, 8432], // 161 |
|
101 | + 37 => [20528, 15936, 11408, 8768], // 165 |
|
102 | + 38 => [21616, 16816, 12016, 9136], // 169 |
|
103 | + 39 => [22496, 17728, 12656, 9776], // 173 |
|
104 | 104 | 40 => [23648, 18672, 13328, 10208], // 177 |
105 | 105 | ]; |
106 | 106 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @var int[][] |
113 | 113 | */ |
114 | 114 | private const FORMAT_PATTERN = [ |
115 | - [ // L |
|
115 | + [// L |
|
116 | 116 | 0b111011111000100, |
117 | 117 | 0b111001011110011, |
118 | 118 | 0b111110110101010, |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | 0b110110001000001, |
123 | 123 | 0b110100101110110, |
124 | 124 | ], |
125 | - [ // M |
|
125 | + [// M |
|
126 | 126 | 0b101010000010010, |
127 | 127 | 0b101000100100101, |
128 | 128 | 0b101111001111100, |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | 0b100111110010111, |
133 | 133 | 0b100101010100000, |
134 | 134 | ], |
135 | - [ // Q |
|
135 | + [// Q |
|
136 | 136 | 0b011010101011111, |
137 | 137 | 0b011000001101000, |
138 | 138 | 0b011111100110001, |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | 0b010111011011010, |
143 | 143 | 0b010101111101101, |
144 | 144 | ], |
145 | - [ // H |
|
145 | + [// H |
|
146 | 146 | 0b001011010001001, |
147 | 147 | 0b001001110111110, |
148 | 148 | 0b001110011100111, |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function __construct(int $eccLevel){ |
165 | 165 | |
166 | - if((0b11 & $eccLevel) !== $eccLevel){ |
|
166 | + if((0b11&$eccLevel) !== $eccLevel){ |
|
167 | 167 | throw new QRCodeException('invalid ECC level'); |
168 | 168 | } |
169 | 169 |
@@ -179,7 +179,7 @@ |
||
179 | 179 | // Above should work but fails on some Apple and Linux JDKs due to a Hotspot bug. |
180 | 180 | // Below is a funny-looking workaround from Steven Parkes |
181 | 181 | $term = GF256::multiply($errorLocations[$j], $xiInverse); |
182 | - $denominator = GF256::multiply($denominator, (($term & 0x1) === 0 ? $term | 1 : $term & ~1)); |
|
182 | + $denominator = GF256::multiply($denominator, (($term&0x1) === 0 ? $term|1 : $term&~1)); |
|
183 | 183 | } |
184 | 184 | } |
185 | 185 |
@@ -143,7 +143,8 @@ |
||
143 | 143 | // This is a direct application of Chien's search |
144 | 144 | $numErrors = $errorLocator->getDegree(); |
145 | 145 | |
146 | - if($numErrors === 1){ // shortcut |
|
146 | + if($numErrors === 1){ |
|
147 | +// shortcut |
|
147 | 148 | return [$errorLocator->getCoefficient(1)]; |
148 | 149 | } |
149 | 150 |
@@ -580,7 +580,7 @@ |
||
580 | 580 | $this->hasSkipped = true; |
581 | 581 | |
582 | 582 | return (int)((abs($firstConfirmedCenter->getX() - $center->getX()) - |
583 | - abs($firstConfirmedCenter->getY() - $center->getY())) / 2); |
|
583 | + abs($firstConfirmedCenter->getY() - $center->getY())) / 2); |
|
584 | 584 | } |
585 | 585 | } |
586 | 586 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | // Black pixel |
76 | 76 | if($this->bitMatrix->get($j, $i)){ |
77 | 77 | // Counting white pixels |
78 | - if(($currentState & 1) === 1){ |
|
78 | + if(($currentState&1) === 1){ |
|
79 | 79 | $currentState++; |
80 | 80 | } |
81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | // White pixel |
85 | 85 | else{ |
86 | 86 | // Counting black pixels |
87 | - if(($currentState & 1) === 0){ |
|
87 | + if(($currentState&1) === 0){ |
|
88 | 88 | // A winner? |
89 | 89 | if($currentState === 4){ |
90 | 90 | // Yes |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * |
331 | 331 | * @return float|null vertical center of finder pattern, or null if not found |
332 | 332 | */ |
333 | - private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal):?float{ |
|
333 | + private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal): ?float{ |
|
334 | 334 | $maxI = $this->bitMatrix->getDimension(); |
335 | 335 | $stateCount = $this->getCrossCheckStateCount(); |
336 | 336 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | * except it reads horizontally instead of vertically. This is used to cross-cross |
414 | 414 | * check a vertical cross check and locate the real center of the alignment pattern. |
415 | 415 | */ |
416 | - private function crossCheckHorizontal(int $startJ, int $centerI, int $maxCount, int $originalStateCountTotal):?float{ |
|
416 | + private function crossCheckHorizontal(int $startJ, int $centerI, int $maxCount, int $originalStateCountTotal): ?float{ |
|
417 | 417 | $maxJ = $this->bitMatrix->getDimension(); |
418 | 418 | $stateCount = $this->getCrossCheckStateCount(); |
419 | 419 |
@@ -88,7 +88,8 @@ |
||
88 | 88 | |
89 | 89 | if($this->bitMatrix->get($j, $i)){ |
90 | 90 | // Black pixel |
91 | - if($currentState === 1){ // Counting black pixels |
|
91 | + if($currentState === 1){ |
|
92 | +// Counting black pixels |
|
92 | 93 | $stateCount[$currentState]++; |
93 | 94 | } |
94 | 95 | // Counting white pixels |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @return \chillerlan\QRCode\Detector\AlignmentPattern|null |
60 | 60 | */ |
61 | - public function find(int $startX, int $startY, int $width, int $height):?AlignmentPattern{ |
|
61 | + public function find(int $startX, int $startY, int $width, int $height): ?AlignmentPattern{ |
|
62 | 62 | $maxJ = $startX + $width; |
63 | 63 | $middleI = $startY + ($height / 2); |
64 | 64 | $stateCount = []; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | // this tracks the number of black/white/black modules seen so far |
68 | 68 | for($iGen = 0; $iGen < $height; $iGen++){ |
69 | 69 | // Search from middle outwards |
70 | - $i = (int)($middleI + (($iGen & 0x01) === 0 ? ($iGen + 1) / 2 : -(($iGen + 1) / 2))); |
|
70 | + $i = (int)($middleI + (($iGen&0x01) === 0 ? ($iGen + 1) / 2 : -(($iGen + 1) / 2))); |
|
71 | 71 | $stateCount[0] = 0; |
72 | 72 | $stateCount[1] = 0; |
73 | 73 | $stateCount[2] = 0; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * |
175 | 175 | * @return \chillerlan\QRCode\Detector\AlignmentPattern|null if we have found the same pattern twice, or null if not |
176 | 176 | */ |
177 | - private function handlePossibleCenter(array $stateCount, int $i, int $j):?AlignmentPattern{ |
|
177 | + private function handlePossibleCenter(array $stateCount, int $i, int $j): ?AlignmentPattern{ |
|
178 | 178 | $stateCountTotal = $stateCount[0] + $stateCount[1] + $stateCount[2]; |
179 | 179 | $centerJ = $this->centerFromEnd($stateCount, $j); |
180 | 180 | $centerI = $this->crossCheckVertical($i, (int)$centerJ, 2 * $stateCount[1], $stateCountTotal); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * |
224 | 224 | * @return float|null vertical center of alignment pattern, or null if not found |
225 | 225 | */ |
226 | - private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal):?float{ |
|
226 | + private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal): ?float{ |
|
227 | 227 | $maxI = $this->bitMatrix->getDimension(); |
228 | 228 | $stateCount = []; |
229 | 229 | $stateCount[0] = 0; |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | } |
162 | 162 | |
163 | 163 | $otherToX = (int)($fromX + ($otherToX - $fromX) * $scale); |
164 | - $result += $this->sizeOfBlackWhiteBlackRun((int)$fromX, (int)$fromY, (int)$otherToX, (int)$otherToY); |
|
164 | + $result += $this->sizeOfBlackWhiteBlackRun((int)$fromX, (int)$fromY, (int)$otherToX, (int)$otherToY); |
|
165 | 165 | |
166 | 166 | // Middle pixel is double-counted this way; subtract 1 |
167 | 167 | return $result - 1.0; |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | int $estAlignmentX, |
292 | 292 | int $estAlignmentY, |
293 | 293 | float $allowanceFactor |
294 | - ):?AlignmentPattern{ |
|
294 | + ): ?AlignmentPattern{ |
|
295 | 295 | // Look for an alignment pattern (3 modules in size) around where it should be |
296 | 296 | $dimension = $this->bitMatrix->getDimension(); |
297 | 297 | $allowance = (int)($allowanceFactor * $overallEstModuleSize); |
@@ -59,7 +59,8 @@ |
||
59 | 59 | $estAlignmentY = (int)($topLeft->getY() + $correctionToTopLeft * ($bottomRightY - $topLeft->getY())); |
60 | 60 | |
61 | 61 | // Kind of arbitrary -- expand search radius before giving up |
62 | - for($i = 4; $i <= 16; $i <<= 1){//?????????? |
|
62 | + for($i = 4; $i <= 16; $i <<= 1){ |
|
63 | +//?????????? |
|
63 | 64 | $alignmentPattern = $this->findAlignmentInRegion($moduleSize, $estAlignmentX, $estAlignmentY, (float)$i); |
64 | 65 | |
65 | 66 | if($alignmentPattern !== null){ |
@@ -57,19 +57,19 @@ |
||
57 | 57 | public static function parseValue(BitBuffer $bitBuffer):ECICharset{ |
58 | 58 | $firstByte = $bitBuffer->read(8); |
59 | 59 | |
60 | - if(($firstByte & 0x80) === 0){ |
|
60 | + if(($firstByte&0x80) === 0){ |
|
61 | 61 | // just one byte |
62 | - return new ECICharset($firstByte & 0x7f); |
|
62 | + return new ECICharset($firstByte&0x7f); |
|
63 | 63 | } |
64 | 64 | |
65 | - if(($firstByte & 0xc0) === 0x80){ |
|
65 | + if(($firstByte&0xc0) === 0x80){ |
|
66 | 66 | // two bytes |
67 | - return new ECICharset((($firstByte & 0x3f) << 8) | $bitBuffer->read(8)); |
|
67 | + return new ECICharset((($firstByte&0x3f) << 8)|$bitBuffer->read(8)); |
|
68 | 68 | } |
69 | 69 | |
70 | - if(($firstByte & 0xe0) === 0xC0){ |
|
70 | + if(($firstByte&0xe0) === 0xC0){ |
|
71 | 71 | // three bytes |
72 | - return new ECICharset((($firstByte & 0x1f) << 16) | $bitBuffer->read(16)); |
|
72 | + return new ECICharset((($firstByte&0x1f) << 16)|$bitBuffer->read(16)); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | throw new QRCodeDataException('error decoding ECI value'); |