@@ -15,7 +15,7 @@ |
||
15 | 15 | /** |
16 | 16 | * |
17 | 17 | */ |
18 | -class QROptions{ |
|
18 | +class QROptions { |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @var int |
@@ -15,20 +15,20 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * |
17 | 17 | */ |
18 | -class Util{ |
|
18 | +class Util { |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @param string $s |
22 | 22 | * |
23 | 23 | * @return bool |
24 | 24 | */ |
25 | - public static function isNumber($s){ |
|
25 | + public static function isNumber($s) { |
|
26 | 26 | |
27 | 27 | $len = strlen($s); |
28 | - for($i = 0; $i < $len; $i++){ |
|
28 | + for ($i = 0; $i < $len; $i++) { |
|
29 | 29 | $c = ord($s[$i]); |
30 | 30 | |
31 | - if(!(ord('0') <= $c && $c <= ord('9'))){ |
|
31 | + if (!(ord('0') <= $c && $c <= ord('9'))) { |
|
32 | 32 | return false; |
33 | 33 | } |
34 | 34 | } |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return bool |
43 | 43 | */ |
44 | - public static function isAlphaNum($s){ |
|
44 | + public static function isAlphaNum($s) { |
|
45 | 45 | |
46 | 46 | $len = strlen($s); |
47 | - for($i = 0; $i < $len; $i++){ |
|
47 | + for ($i = 0; $i < $len; $i++) { |
|
48 | 48 | $c = ord($s[$i]); |
49 | 49 | |
50 | - if(!(ord('0') <= $c && $c <= ord('9')) && !(ord('A') <= $c && $c <= ord('Z')) && strpos(' $%*+-./:', $s[$i]) === false){ |
|
50 | + if (!(ord('0') <= $c && $c <= ord('9')) && !(ord('A') <= $c && $c <= ord('Z')) && strpos(' $%*+-./:', $s[$i]) === false) { |
|
51 | 51 | return false; |
52 | 52 | } |
53 | 53 | } |
@@ -60,25 +60,25 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return bool |
62 | 62 | */ |
63 | - public static function isKanji($s){ |
|
63 | + public static function isKanji($s) { |
|
64 | 64 | |
65 | - if(empty($s)){ |
|
65 | + if (empty($s)) { |
|
66 | 66 | return false; |
67 | 67 | } |
68 | 68 | |
69 | 69 | $i = 0; |
70 | 70 | $len = strlen($s); |
71 | - while($i + 1 < $len){ |
|
71 | + while ($i + 1 < $len) { |
|
72 | 72 | $c = ((0xff&ord($s[$i])) << 8)|(0xff&ord($s[$i + 1])); |
73 | 73 | |
74 | - if(!($c >= 0x8140 && $c <= 0x9FFC) && !($c >= 0xE040 && $c <= 0xEBBF)){ |
|
74 | + if (!($c >= 0x8140 && $c <= 0x9FFC) && !($c >= 0xE040 && $c <= 0xEBBF)) { |
|
75 | 75 | return false; |
76 | 76 | } |
77 | 77 | |
78 | 78 | $i += 2; |
79 | 79 | } |
80 | 80 | |
81 | - if($i < $len){ |
|
81 | + if ($i < $len) { |
|
82 | 82 | return false; |
83 | 83 | } |
84 | 84 | |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @return int |
92 | 92 | */ |
93 | - public static function getBCHTypeInfo($data){ |
|
93 | + public static function getBCHTypeInfo($data) { |
|
94 | 94 | $d = $data << 10; |
95 | 95 | |
96 | - while(self::getBCHDigit($d) - self::getBCHDigit(QRConst::G15) >= 0){ |
|
96 | + while (self::getBCHDigit($d) - self::getBCHDigit(QRConst::G15) >= 0) { |
|
97 | 97 | $d ^= (QRConst::G15 << (self::getBCHDigit($d) - self::getBCHDigit(QRConst::G15))); |
98 | 98 | } |
99 | 99 | |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return int |
107 | 107 | */ |
108 | - public static function getBCHTypeNumber($data){ |
|
108 | + public static function getBCHTypeNumber($data) { |
|
109 | 109 | $d = $data << 12; |
110 | 110 | |
111 | - while(self::getBCHDigit($d) - self::getBCHDigit(QRConst::G18) >= 0){ |
|
111 | + while (self::getBCHDigit($d) - self::getBCHDigit(QRConst::G18) >= 0) { |
|
112 | 112 | $d ^= (QRConst::G18 << (self::getBCHDigit($d) - self::getBCHDigit(QRConst::G18))); |
113 | 113 | } |
114 | 114 | |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return int |
122 | 122 | */ |
123 | - public static function getBCHDigit($data){ |
|
123 | + public static function getBCHDigit($data) { |
|
124 | 124 | $digit = 0; |
125 | 125 | |
126 | - while($data !== 0){ |
|
126 | + while ($data !== 0) { |
|
127 | 127 | $digit++; |
128 | 128 | $data >>= 1; |
129 | 129 | } |
@@ -138,12 +138,12 @@ discard block |
||
138 | 138 | * @return array |
139 | 139 | * @throws \chillerlan\QRCode\QRCodeException |
140 | 140 | */ |
141 | - public static function getRSBlocks($typeNumber, $errorCorrectLevel){ |
|
141 | + public static function getRSBlocks($typeNumber, $errorCorrectLevel) { |
|
142 | 142 | // PHP5 compat |
143 | 143 | $RSBLOCK = QRConst::RSBLOCK; |
144 | 144 | $BLOCK_TABLE = QRConst::BLOCK_TABLE; |
145 | 145 | |
146 | - if(!isset($RSBLOCK[$errorCorrectLevel])){ |
|
146 | + if (!isset($RSBLOCK[$errorCorrectLevel])) { |
|
147 | 147 | throw new QRCodeException('$typeNumber: '.$typeNumber.' / $errorCorrectLevel: '.$errorCorrectLevel); |
148 | 148 | } |
149 | 149 | |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | |
152 | 152 | $list = []; |
153 | 153 | $length = count($rsBlock) / 3; |
154 | - for($i = 0; $i < $length; $i++){ |
|
155 | - for($j = 0; $j < $rsBlock[$i * 3 + 0]; $j++){ |
|
154 | + for ($i = 0; $i < $length; $i++) { |
|
155 | + for ($j = 0; $j < $rsBlock[$i * 3 + 0]; $j++) { |
|
156 | 156 | $list[] = [$rsBlock[$i * 3 + 1], $rsBlock[$i * 3 + 2]]; |
157 | 157 | } |
158 | 158 | } |
@@ -168,16 +168,16 @@ discard block |
||
168 | 168 | * @return int |
169 | 169 | * @throws \chillerlan\QRCode\QRCodeException |
170 | 170 | */ |
171 | - public static function getMaxLength($typeNumber, $mode, $ecLevel){ |
|
171 | + public static function getMaxLength($typeNumber, $mode, $ecLevel) { |
|
172 | 172 | $RSBLOCK = QRConst::RSBLOCK; |
173 | 173 | $MAX_LENGTH = QRConst::MAX_LENGTH; |
174 | 174 | $MODE = QRConst::MODE; |
175 | 175 | |
176 | - if(!isset($RSBLOCK[$ecLevel])){ |
|
176 | + if (!isset($RSBLOCK[$ecLevel])) { |
|
177 | 177 | throw new QRCodeException('Invalid error correct level: '.$ecLevel); |
178 | 178 | } |
179 | 179 | |
180 | - if(!isset($MODE[$mode])){ |
|
180 | + if (!isset($MODE[$mode])) { |
|
181 | 181 | throw new QRCodeException('Invalid mode: '.$mode); |
182 | 182 | } |
183 | 183 |