@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $len = strlen($this->data); |
132 | 132 | |
133 | 133 | for($i = 0; ($i + 1) < $len; $i += 2){ |
134 | - $c = (((0xff & ord($this->data[$i])) << 8) | (0xff & ord($this->data[($i + 1)]))); |
|
134 | + $c = (((0xff & ord($this->data[$i])) << 8)|(0xff & ord($this->data[($i + 1)]))); |
|
135 | 135 | |
136 | 136 | if($c >= 0xa1a1 && $c <= 0xaafe){ |
137 | 137 | $c -= 0x0a1a1; |
@@ -177,15 +177,15 @@ discard block |
||
177 | 177 | while($length > 0){ |
178 | 178 | // Each 13 bits encodes a 2-byte character |
179 | 179 | $twoBytes = $bitBuffer->read(13); |
180 | - $assembledTwoBytes = ((((int)($twoBytes / 0x060)) << 8) | ($twoBytes % 0x060)); |
|
180 | + $assembledTwoBytes = ((((int)($twoBytes / 0x060)) << 8)|($twoBytes % 0x060)); |
|
181 | 181 | |
182 | 182 | $assembledTwoBytes += ($assembledTwoBytes < 0x00a00) // 0x003BF |
183 | 183 | ? 0x0a1a1 // In the 0xA1A1 to 0xAAFE range |
184 | 184 | : 0x0a6a1; // In the 0xB0A1 to 0xFAFE range |
185 | 185 | |
186 | 186 | $buffer[$offset] = chr(0xff & ($assembledTwoBytes >> 8)); |
187 | - $buffer[($offset + 1)] = chr(0xff & $assembledTwoBytes); |
|
188 | - $offset += 2; |
|
187 | + $buffer[($offset + 1)] = chr(0xff&$assembledTwoBytes); |
|
188 | + $offset += 2; |
|
189 | 189 | $length--; |
190 | 190 | } |
191 | 191 |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | */ |
60 | 60 | protected const neighbours = [ |
61 | 61 | 0b00000001 => [-1, -1], |
62 | - 0b00000010 => [ 0, -1], |
|
63 | - 0b00000100 => [ 1, -1], |
|
64 | - 0b00001000 => [ 1, 0], |
|
65 | - 0b00010000 => [ 1, 1], |
|
66 | - 0b00100000 => [ 0, 1], |
|
67 | - 0b01000000 => [-1, 1], |
|
68 | - 0b10000000 => [-1, 0], |
|
62 | + 0b00000010 => [0, -1], |
|
63 | + 0b00000100 => [1, -1], |
|
64 | + 0b00001000 => [1, 0], |
|
65 | + 0b00010000 => [1, 1], |
|
66 | + 0b00100000 => [0, 1], |
|
67 | + 0b01000000 => [-1, 1], |
|
68 | + 0b10000000 => [-1, 0], |
|
69 | 69 | ]; |
70 | 70 | |
71 | 71 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $matrix[$y] = []; |
146 | 146 | |
147 | 147 | foreach($row as $x => $val){ |
148 | - $matrix[$y][$x] = ($val & $this::IS_DARK) === $this::IS_DARK; |
|
148 | + $matrix[$y][$x] = ($val&$this::IS_DARK) === $this::IS_DARK; |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
@@ -155,21 +155,21 @@ discard block |
||
155 | 155 | /** |
156 | 156 | * Returns the current version number |
157 | 157 | */ |
158 | - public function version():?Version{ |
|
158 | + public function version(): ?Version{ |
|
159 | 159 | return $this->version; |
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
163 | 163 | * Returns the current ECC level |
164 | 164 | */ |
165 | - public function eccLevel():?EccLevel{ |
|
165 | + public function eccLevel(): ?EccLevel{ |
|
166 | 166 | return $this->eccLevel; |
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
170 | 170 | * Returns the current mask pattern |
171 | 171 | */ |
172 | - public function maskPattern():?MaskPattern{ |
|
172 | + public function maskPattern(): ?MaskPattern{ |
|
173 | 173 | return $this->maskPattern; |
174 | 174 | } |
175 | 175 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | public function set(int $x, int $y, bool $value, int $M_TYPE):self{ |
204 | 204 | |
205 | 205 | if(isset($this->matrix[$y][$x])){ |
206 | - $this->matrix[$y][$x] = ($M_TYPE | (($value) ? $this::IS_DARK : 0)); |
|
206 | + $this->matrix[$y][$x] = ($M_TYPE|(($value) ? $this::IS_DARK : 0)); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | return $this; |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | return false; |
233 | 233 | } |
234 | 234 | |
235 | - return ($this->matrix[$y][$x] & $M_TYPE) === $M_TYPE; |
|
235 | + return ($this->matrix[$y][$x]&$M_TYPE) === $M_TYPE; |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | /** |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | // check if the field is the same type |
277 | 277 | if( |
278 | 278 | $M_TYPE_VALUE !== null |
279 | - && ($this->get(($x + $ix), ($y + $iy)) | $this::IS_DARK) !== ($M_TYPE_VALUE | $this::IS_DARK) |
|
279 | + && ($this->get(($x + $ix), ($y + $iy))|$this::IS_DARK) !== ($M_TYPE_VALUE|$this::IS_DARK) |
|
280 | 280 | ){ |
281 | 281 | continue; |
282 | 282 | } |
@@ -356,8 +356,8 @@ discard block |
||
356 | 356 | |
357 | 357 | for($c = 0; $c < 3; $c++){ |
358 | 358 | for($i = 0; $i < 8; $i++){ |
359 | - $this->set($h[$c][0] , ($h[$c][1] + $i), false, $this::M_SEPARATOR); |
|
360 | - $this->set(($v[$c][0] - $i), $v[$c][1] , false, $this::M_SEPARATOR); |
|
359 | + $this->set($h[$c][0], ($h[$c][1] + $i), false, $this::M_SEPARATOR); |
|
360 | + $this->set(($v[$c][0] - $i), $v[$c][1], false, $this::M_SEPARATOR); |
|
361 | 361 | } |
362 | 362 | } |
363 | 363 | |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | for($y = 0; $y < $this->moduleCount; $y++){ |
582 | 582 | for($x = 0; $x < $this->moduleCount; $x++){ |
583 | 583 | // out of bounds, skip |
584 | - if($x < $start || $y < $start ||$x >= $end || $y >= $end){ |
|
584 | + if($x < $start || $y < $start || $x >= $end || $y >= $end){ |
|
585 | 585 | continue; |
586 | 586 | } |
587 | 587 | // a match |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | |
650 | 650 | foreach($this->matrix as $y => $row){ |
651 | 651 | foreach($row as $x => $val){ |
652 | - if($mask($x, $y) && ($val & $this::M_DATA) === $this::M_DATA){ |
|
652 | + if($mask($x, $y) && ($val&$this::M_DATA) === $this::M_DATA){ |
|
653 | 653 | $this->flip($x, $y); |
654 | 654 | } |
655 | 655 | } |