@@ -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 = []; |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | * |
| 174 | 174 | * @return \chillerlan\QRCode\Detector\AlignmentPattern|null if we have found the same pattern twice, or null if not |
| 175 | 175 | */ |
| 176 | - private function handlePossibleCenter(array $stateCount, int $i, int $j):?AlignmentPattern{ |
|
| 176 | + private function handlePossibleCenter(array $stateCount, int $i, int $j): ?AlignmentPattern{ |
|
| 177 | 177 | $stateCountTotal = ($stateCount[0] + $stateCount[1] + $stateCount[2]); |
| 178 | 178 | $centerJ = $this->centerFromEnd($stateCount, $j); |
| 179 | 179 | $centerI = $this->crossCheckVertical($i, (int)$centerJ, (2 * $stateCount[1]), $stateCountTotal); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | * |
| 223 | 223 | * @return float|null vertical center of alignment pattern, or null if not found |
| 224 | 224 | */ |
| 225 | - private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal):?float{ |
|
| 225 | + private function crossCheckVertical(int $startI, int $centerJ, int $maxCount, int $originalStateCountTotal): ?float{ |
|
| 226 | 226 | $maxI = $this->matrix->size(); |
| 227 | 227 | $stateCount = []; |
| 228 | 228 | $stateCount[0] = 0; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $byte2 = ord($string[($i + 1)]); |
| 100 | 100 | |
| 101 | 101 | // byte 1 unused and vendor ranges |
| 102 | - if($byte1 < 0x81 || ($byte1 > 0x84 && $byte1 < 0x88) || ($byte1 > 0x9f && $byte1 < 0xe0) || $byte1 > 0xea){ |
|
| 102 | + if($byte1 < 0x81 || ($byte1 > 0x84 && $byte1 < 0x88) || ($byte1 > 0x9f && $byte1 < 0xe0) || $byte1 > 0xea){ |
|
| 103 | 103 | return false; |
| 104 | 104 | } |
| 105 | 105 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $len = strlen($this->data); |
| 129 | 129 | |
| 130 | 130 | for($i = 0; ($i + 1) < $len; $i += 2){ |
| 131 | - $c = (((0xff & ord($this->data[$i])) << 8) | (0xff & ord($this->data[($i + 1)]))); |
|
| 131 | + $c = (((0xff & ord($this->data[$i])) << 8)|(0xff & ord($this->data[($i + 1)]))); |
|
| 132 | 132 | |
| 133 | 133 | if($c >= 0x8140 && $c <= 0x9ffc){ |
| 134 | 134 | $c -= 0x8140; |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $length = $bitBuffer->read(self::getLengthBits($versionNumber)); |
| 159 | 159 | |
| 160 | 160 | if($bitBuffer->available() < ($length * 13)){ |
| 161 | - throw new QRCodeDataException('not enough bits available'); // @codeCoverageIgnore |
|
| 161 | + throw new QRCodeDataException('not enough bits available'); // @codeCoverageIgnore |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | // Each character will require 2 bytes. Read the characters as 2-byte pairs and decode as SJIS afterwards |
@@ -168,15 +168,15 @@ discard block |
||
| 168 | 168 | while($length > 0){ |
| 169 | 169 | // Each 13 bits encodes a 2-byte character |
| 170 | 170 | $twoBytes = $bitBuffer->read(13); |
| 171 | - $assembledTwoBytes = ((((int)($twoBytes / 0x0c0)) << 8) | ($twoBytes % 0x0c0)); |
|
| 171 | + $assembledTwoBytes = ((((int)($twoBytes / 0x0c0)) << 8)|($twoBytes % 0x0c0)); |
|
| 172 | 172 | |
| 173 | 173 | $assembledTwoBytes += ($assembledTwoBytes < 0x01f00) |
| 174 | 174 | ? 0x08140 // In the 0x8140 to 0x9FFC range |
| 175 | 175 | : 0x0c140; // In the 0xE040 to 0xEBBF range |
| 176 | 176 | |
| 177 | 177 | $buffer[$offset] = chr(0xff & ($assembledTwoBytes >> 8)); |
| 178 | - $buffer[($offset + 1)] = chr(0xff & $assembledTwoBytes); |
|
| 179 | - $offset += 2; |
|
| 178 | + $buffer[($offset + 1)] = chr(0xff&$assembledTwoBytes); |
|
| 179 | + $offset += 2; |
|
| 180 | 180 | $length--; |
| 181 | 181 | } |
| 182 | 182 | |
@@ -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 | foreach($this->matrix as $y => $row){ |
| 582 | 582 | foreach($row as $x => $val){ |
| 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 | } |