@@ -17,16 +17,16 @@ discard block |
||
17 | 17 | |
18 | 18 | class ECICharset{ |
19 | 19 | |
20 | - public const CP437 = 0; // Code page 437, DOS Latin US |
|
21 | - public const ISO_IEC_8859_1_GLI = 1; // GLI encoding with characters 0 to 127 identical to ISO/IEC 646 and characters 128 to 255 identical to ISO 8859-1 |
|
22 | - public const CP437_WO_GLI = 2; // An equivalent code table to CP437, without the return-to-GLI 0 logic |
|
23 | - public const ISO_IEC_8859_1 = 3; // Latin-1 (Default) |
|
24 | - public const ISO_IEC_8859_2 = 4; // Latin-2 |
|
25 | - public const ISO_IEC_8859_3 = 5; // Latin-3 |
|
26 | - public const ISO_IEC_8859_4 = 6; // Latin-4 |
|
27 | - public const ISO_IEC_8859_5 = 7; // Latin/Cyrillic |
|
28 | - public const ISO_IEC_8859_6 = 8; // Latin/Arabic |
|
29 | - public const ISO_IEC_8859_7 = 9; // Latin/Greek |
|
20 | + public const CP437 = 0; // Code page 437, DOS Latin US |
|
21 | + public const ISO_IEC_8859_1_GLI = 1; // GLI encoding with characters 0 to 127 identical to ISO/IEC 646 and characters 128 to 255 identical to ISO 8859-1 |
|
22 | + public const CP437_WO_GLI = 2; // An equivalent code table to CP437, without the return-to-GLI 0 logic |
|
23 | + public const ISO_IEC_8859_1 = 3; // Latin-1 (Default) |
|
24 | + public const ISO_IEC_8859_2 = 4; // Latin-2 |
|
25 | + public const ISO_IEC_8859_3 = 5; // Latin-3 |
|
26 | + public const ISO_IEC_8859_4 = 6; // Latin-4 |
|
27 | + public const ISO_IEC_8859_5 = 7; // Latin/Cyrillic |
|
28 | + public const ISO_IEC_8859_6 = 8; // Latin/Arabic |
|
29 | + public const ISO_IEC_8859_7 = 9; // Latin/Greek |
|
30 | 30 | public const ISO_IEC_8859_8 = 10; // Latin/Hebrew |
31 | 31 | public const ISO_IEC_8859_9 = 11; // Latin-5 |
32 | 32 | public const ISO_IEC_8859_10 = 12; // Latin-6 |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | return $this->charsetID; |
102 | 102 | } |
103 | 103 | |
104 | - public function getName():?string{ |
|
104 | + public function getName(): ?string{ |
|
105 | 105 | return self::MB_ENCODINGS[$this->charsetID]; |
106 | 106 | } |
107 | 107 |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | public function put(int $num, int $length):BitBuffer{ |
60 | 60 | |
61 | 61 | for($i = 0; $i < $length; $i++){ |
62 | - $this->putBit((($num >> ($length - $i - 1)) & 1) === 1); |
|
62 | + $this->putBit((($num >> ($length - $i - 1))&1) === 1); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | return $this; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $toRead = $numBits < $bitsLeft ? $numBits : $bitsLeft; |
129 | 129 | $bitsToNotRead = $bitsLeft - $toRead; |
130 | 130 | $mask = (0xff >> (8 - $toRead)) << $bitsToNotRead; |
131 | - $result = ($this->buffer[$this->bytesRead] & $mask) >> $bitsToNotRead; |
|
131 | + $result = ($this->buffer[$this->bytesRead]&$mask) >> $bitsToNotRead; |
|
132 | 132 | $numBits -= $toRead; |
133 | 133 | $this->bitsRead += $toRead; |
134 | 134 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | if($numBits > 0){ |
143 | 143 | |
144 | 144 | while($numBits >= 8){ |
145 | - $result = ($result << 8) | ($this->buffer[$this->bytesRead] & 0xff); |
|
145 | + $result = ($result << 8)|($this->buffer[$this->bytesRead]&0xff); |
|
146 | 146 | $this->bytesRead++; |
147 | 147 | $numBits -= 8; |
148 | 148 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | if($numBits > 0){ |
152 | 152 | $bitsToNotRead = 8 - $numBits; |
153 | 153 | $mask = (0xff >> $bitsToNotRead) << $bitsToNotRead; |
154 | - $result = ($result << $numBits) | (($this->buffer[$this->bytesRead] & $mask) >> $bitsToNotRead); |
|
154 | + $result = ($result << $numBits)|(($this->buffer[$this->bytesRead]&$mask) >> $bitsToNotRead); |
|
155 | 155 | $this->bitsRead += $numBits; |
156 | 156 | } |
157 | 157 | } |
@@ -44,8 +44,8 @@ |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
47 | - * @inheritDoc |
|
48 | - */ |
|
47 | + * @inheritDoc |
|
48 | + */ |
|
49 | 49 | public function write(BitBuffer $bitBuffer, int $versionNumber):void{ |
50 | 50 | $bitBuffer |
51 | 51 | ->put($this::$datamode, 4) |
@@ -59,23 +59,23 @@ |
||
59 | 59 | public static function parseValue(BitBuffer $bitBuffer):int{ |
60 | 60 | $firstByte = $bitBuffer->read(8); |
61 | 61 | |
62 | - if(($firstByte & 0x80) === 0){ |
|
62 | + if(($firstByte&0x80) === 0){ |
|
63 | 63 | // just one byte |
64 | - return $firstByte & 0x7f; |
|
64 | + return $firstByte&0x7f; |
|
65 | 65 | } |
66 | 66 | |
67 | - if(($firstByte & 0xc0) === 0x80){ |
|
67 | + if(($firstByte&0xc0) === 0x80){ |
|
68 | 68 | // two bytes |
69 | 69 | $secondByte = $bitBuffer->read(8); |
70 | 70 | |
71 | - return (($firstByte & 0x3f) << 8) | $secondByte; |
|
71 | + return (($firstByte&0x3f) << 8)|$secondByte; |
|
72 | 72 | } |
73 | 73 | |
74 | - if(($firstByte & 0xe0) === 0xC0){ |
|
74 | + if(($firstByte&0xe0) === 0xC0){ |
|
75 | 75 | // three bytes |
76 | 76 | $secondThirdBytes = $bitBuffer->read(16); |
77 | 77 | |
78 | - return (($firstByte & 0x1f) << 16) | $secondThirdBytes; |
|
78 | + return (($firstByte&0x1f) << 16)|$secondThirdBytes; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | throw new QRCodeDataException('error decoding ECI value'); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $len = strlen($string); |
56 | 56 | |
57 | 57 | while($i + 1 < $len){ |
58 | - $c = ((0xff & ord($string[$i])) << 8) | (0xff & ord($string[$i + 1])); |
|
58 | + $c = ((0xff&ord($string[$i])) << 8)|(0xff&ord($string[$i + 1])); |
|
59 | 59 | |
60 | 60 | if(!($c >= 0x8140 && $c <= 0x9ffc) && !($c >= 0xe040 && $c <= 0xebbf)){ |
61 | 61 | return false; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $len = strlen($this->data); |
83 | 83 | |
84 | 84 | for($i = 0; $i + 1 < $len; $i += 2){ |
85 | - $c = ((0xff & ord($this->data[$i])) << 8) | (0xff & ord($this->data[$i + 1])); |
|
85 | + $c = ((0xff&ord($this->data[$i])) << 8)|(0xff&ord($this->data[$i + 1])); |
|
86 | 86 | |
87 | 87 | if($c >= 0x8140 && $c <= 0x9ffC){ |
88 | 88 | $c -= 0x8140; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | throw new QRCodeDataException(sprintf('illegal char at %d [%d]', $i + 1, $c)); |
95 | 95 | } |
96 | 96 | |
97 | - $bitBuffer->put(((($c >> 8) & 0xff) * 0xc0) + ($c & 0xff), 13); |
|
97 | + $bitBuffer->put(((($c >> 8)&0xff) * 0xc0) + ($c&0xff), 13); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | if($i < $len){ |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | while($length > 0){ |
122 | 122 | // Each 13 bits encodes a 2-byte character |
123 | 123 | $twoBytes = $bitBuffer->read(13); |
124 | - $assembledTwoBytes = (($twoBytes / 0x0c0) << 8) | ($twoBytes % 0x0c0); |
|
124 | + $assembledTwoBytes = (($twoBytes / 0x0c0) << 8)|($twoBytes % 0x0c0); |
|
125 | 125 | |
126 | 126 | $assembledTwoBytes += ($assembledTwoBytes < 0x01f00) |
127 | 127 | ? 0x08140 // In the 0x8140 to 0x9FFC range |
128 | 128 | : 0x0c140; // In the 0xE040 to 0xEBBF range |
129 | 129 | |
130 | - $buffer[$offset] = chr(0xff & ($assembledTwoBytes >> 8)); |
|
131 | - $buffer[$offset + 1] = chr(0xff & $assembledTwoBytes); |
|
132 | - $offset += 2; |
|
130 | + $buffer[$offset] = chr(0xff&($assembledTwoBytes >> 8)); |
|
131 | + $buffer[$offset + 1] = chr(0xff&$assembledTwoBytes); |
|
132 | + $offset += 2; |
|
133 | 133 | $length--; |
134 | 134 | } |
135 | 135 |