@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | * @return float|null vertical center of finder pattern, or null if not found |
| 331 | 331 | * @noinspection DuplicatedCode |
| 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->matrix->getSize(); |
| 335 | 335 | $stateCount = $this->getCrossCheckStateCount(); |
| 336 | 336 | |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | * check a vertical cross-check and locate the real center of the alignment pattern. |
| 415 | 415 | * @noinspection DuplicatedCode |
| 416 | 416 | */ |
| 417 | - private function crossCheckHorizontal(int $startJ, int $centerI, int $maxCount, int $originalStateCountTotal):?float{ |
|
| 417 | + private function crossCheckHorizontal(int $startJ, int $centerI, int $maxCount, int $originalStateCountTotal): ?float{ |
|
| 418 | 418 | $maxJ = $this->matrix->getSize(); |
| 419 | 419 | $stateCount = $this->getCrossCheckStateCount(); |
| 420 | 420 | |
@@ -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->getSize(); |
| 227 | 227 | $stateCount = []; |
| 228 | 228 | $stateCount[0] = 0; |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $otherToX = (int)($fromX + ($otherToX - $fromX) * $scale); |
| 154 | - $result += $this->sizeOfBlackWhiteBlackRun((int)$fromX, (int)$fromY, $otherToX, $otherToY); |
|
| 154 | + $result += $this->sizeOfBlackWhiteBlackRun((int)$fromX, (int)$fromY, $otherToX, $otherToY); |
|
| 155 | 155 | |
| 156 | 156 | // Middle pixel is double-counted this way; subtract 1 |
| 157 | 157 | return ($result - 1.0); |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | int $estAlignmentX, |
| 277 | 277 | int $estAlignmentY, |
| 278 | 278 | float $allowanceFactor |
| 279 | - ):?AlignmentPattern{ |
|
| 279 | + ): ?AlignmentPattern{ |
|
| 280 | 280 | // Look for an alignment pattern (3 modules in size) around where it should be |
| 281 | 281 | $dimension = $this->matrix->getSize(); |
| 282 | 282 | $allowance = (int)($allowanceFactor * $overallEstModuleSize); |
@@ -26,43 +26,43 @@ discard block |
||
| 26 | 26 | /** @var int */ |
| 27 | 27 | public const M_NULL = 0b000000000000; |
| 28 | 28 | /** @var int */ |
| 29 | - public const M_DARKMODULE = (0b000000000001 | self::IS_DARK); |
|
| 29 | + public const M_DARKMODULE = (0b000000000001|self::IS_DARK); |
|
| 30 | 30 | /** @var int */ |
| 31 | 31 | public const M_DATA = 0b000000000010; |
| 32 | 32 | /** @var int */ |
| 33 | - public const M_DATA_DARK = (self::M_DATA | self::IS_DARK); |
|
| 33 | + public const M_DATA_DARK = (self::M_DATA|self::IS_DARK); |
|
| 34 | 34 | /** @var int */ |
| 35 | 35 | public const M_FINDER = 0b000000000100; |
| 36 | 36 | /** @var int */ |
| 37 | - public const M_FINDER_DARK = (self::M_FINDER | self::IS_DARK); |
|
| 37 | + public const M_FINDER_DARK = (self::M_FINDER|self::IS_DARK); |
|
| 38 | 38 | /** @var int */ |
| 39 | 39 | public const M_SEPARATOR = 0b000000001000; |
| 40 | 40 | /** @var int */ |
| 41 | 41 | public const M_ALIGNMENT = 0b000000010000; |
| 42 | 42 | /** @var int */ |
| 43 | - public const M_ALIGNMENT_DARK = (self::M_ALIGNMENT | self::IS_DARK); |
|
| 43 | + public const M_ALIGNMENT_DARK = (self::M_ALIGNMENT|self::IS_DARK); |
|
| 44 | 44 | /** @var int */ |
| 45 | 45 | public const M_TIMING = 0b000000100000; |
| 46 | 46 | /** @var int */ |
| 47 | - public const M_TIMING_DARK = (self::M_TIMING | self::IS_DARK); |
|
| 47 | + public const M_TIMING_DARK = (self::M_TIMING|self::IS_DARK); |
|
| 48 | 48 | /** @var int */ |
| 49 | 49 | public const M_FORMAT = 0b000001000000; |
| 50 | 50 | /** @var int */ |
| 51 | - public const M_FORMAT_DARK = (self::M_FORMAT | self::IS_DARK); |
|
| 51 | + public const M_FORMAT_DARK = (self::M_FORMAT|self::IS_DARK); |
|
| 52 | 52 | /** @var int */ |
| 53 | 53 | public const M_VERSION = 0b000010000000; |
| 54 | 54 | /** @var int */ |
| 55 | - public const M_VERSION_DARK = (self::M_VERSION | self::IS_DARK); |
|
| 55 | + public const M_VERSION_DARK = (self::M_VERSION|self::IS_DARK); |
|
| 56 | 56 | /** @var int */ |
| 57 | 57 | public const M_QUIETZONE = 0b000100000000; |
| 58 | 58 | /** @var int */ |
| 59 | 59 | public const M_LOGO = 0b001000000000; |
| 60 | 60 | /** @var int */ |
| 61 | - public const M_FINDER_DOT = (0b010000000000 | self::IS_DARK); |
|
| 61 | + public const M_FINDER_DOT = (0b010000000000|self::IS_DARK); |
|
| 62 | 62 | /** @var int */ |
| 63 | 63 | public const M_TEST = 0b011111111111; |
| 64 | 64 | /** @var int */ |
| 65 | - public const M_TEST_DARK = (self::M_TEST | self::IS_DARK); |
|
| 65 | + public const M_TEST_DARK = (self::M_TEST|self::IS_DARK); |
|
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * Map of flag => coord |
@@ -73,13 +73,13 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | protected const neighbours = [ |
| 75 | 75 | 0b00000001 => [-1, -1], |
| 76 | - 0b00000010 => [ 0, -1], |
|
| 77 | - 0b00000100 => [ 1, -1], |
|
| 78 | - 0b00001000 => [ 1, 0], |
|
| 79 | - 0b00010000 => [ 1, 1], |
|
| 80 | - 0b00100000 => [ 0, 1], |
|
| 81 | - 0b01000000 => [-1, 1], |
|
| 82 | - 0b10000000 => [-1, 0], |
|
| 76 | + 0b00000010 => [0, -1], |
|
| 77 | + 0b00000100 => [1, -1], |
|
| 78 | + 0b00001000 => [1, 0], |
|
| 79 | + 0b00010000 => [1, 1], |
|
| 80 | + 0b00100000 => [0, 1], |
|
| 81 | + 0b01000000 => [-1, 1], |
|
| 82 | + 0b10000000 => [-1, 0], |
|
| 83 | 83 | ]; |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $matrix[$y] = []; |
| 163 | 163 | |
| 164 | 164 | foreach($row as $x => $val){ |
| 165 | - $matrix[$y][$x] = ($val & $this::IS_DARK) === $this::IS_DARK; |
|
| 165 | + $matrix[$y][$x] = ($val&$this::IS_DARK) === $this::IS_DARK; |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | /** |
| 182 | 182 | * Returns the current version number |
| 183 | 183 | */ |
| 184 | - public function getVersion():?Version{ |
|
| 184 | + public function getVersion(): ?Version{ |
|
| 185 | 185 | return $this->version; |
| 186 | 186 | } |
| 187 | 187 | |
@@ -190,14 +190,14 @@ discard block |
||
| 190 | 190 | * @see \chillerlan\QRCode\Data\QRMatrix::getVersion() |
| 191 | 191 | * @codeCoverageIgnore |
| 192 | 192 | */ |
| 193 | - public function version():?Version{ |
|
| 193 | + public function version(): ?Version{ |
|
| 194 | 194 | return $this->getVersion(); |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
| 198 | 198 | * Returns the current ECC level |
| 199 | 199 | */ |
| 200 | - public function getEccLevel():?EccLevel{ |
|
| 200 | + public function getEccLevel(): ?EccLevel{ |
|
| 201 | 201 | return $this->eccLevel; |
| 202 | 202 | } |
| 203 | 203 | |
@@ -206,14 +206,14 @@ discard block |
||
| 206 | 206 | * @see \chillerlan\QRCode\Data\QRMatrix::getEccLevel() |
| 207 | 207 | * @codeCoverageIgnore |
| 208 | 208 | */ |
| 209 | - public function eccLevel():?EccLevel{ |
|
| 209 | + public function eccLevel(): ?EccLevel{ |
|
| 210 | 210 | return $this->getEccLevel(); |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
| 214 | 214 | * Returns the current mask pattern |
| 215 | 215 | */ |
| 216 | - public function getMaskPattern():?MaskPattern{ |
|
| 216 | + public function getMaskPattern(): ?MaskPattern{ |
|
| 217 | 217 | return $this->maskPattern; |
| 218 | 218 | } |
| 219 | 219 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | * @see \chillerlan\QRCode\Data\QRMatrix::getMaskPattern() |
| 223 | 223 | * @codeCoverageIgnore |
| 224 | 224 | */ |
| 225 | - public function maskPattern():?MaskPattern{ |
|
| 225 | + public function maskPattern(): ?MaskPattern{ |
|
| 226 | 226 | return $this->getMaskPattern(); |
| 227 | 227 | } |
| 228 | 228 | |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | public function set(int $x, int $y, bool $value, int $M_TYPE):self{ |
| 266 | 266 | |
| 267 | 267 | if(isset($this->matrix[$y][$x])){ |
| 268 | - $this->matrix[$y][$x] = (($M_TYPE & ~$this::IS_DARK) | (($value) ? $this::IS_DARK : 0)); |
|
| 268 | + $this->matrix[$y][$x] = (($M_TYPE & ~$this::IS_DARK)|(($value) ? $this::IS_DARK : 0)); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | return $this; |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | return false; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | - return ($this->matrix[$y][$x] & $M_TYPE) === $M_TYPE; |
|
| 297 | + return ($this->matrix[$y][$x]&$M_TYPE) === $M_TYPE; |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | /** |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | // check if the field is the same type |
| 339 | 339 | if( |
| 340 | 340 | $M_TYPE_VALUE !== null |
| 341 | - && ($this->get(($x + $ix), ($y + $iy)) | $this::IS_DARK) !== ($M_TYPE_VALUE | $this::IS_DARK) |
|
| 341 | + && ($this->get(($x + $ix), ($y + $iy))|$this::IS_DARK) !== ($M_TYPE_VALUE|$this::IS_DARK) |
|
| 342 | 342 | ){ |
| 343 | 343 | continue; |
| 344 | 344 | } |
@@ -418,8 +418,8 @@ discard block |
||
| 418 | 418 | |
| 419 | 419 | for($c = 0; $c < 3; $c++){ |
| 420 | 420 | for($i = 0; $i < 8; $i++){ |
| 421 | - $this->set($h[$c][0] , ($h[$c][1] + $i), false, $this::M_SEPARATOR); |
|
| 422 | - $this->set(($v[$c][0] - $i), $v[$c][1] , false, $this::M_SEPARATOR); |
|
| 421 | + $this->set($h[$c][0], ($h[$c][1] + $i), false, $this::M_SEPARATOR); |
|
| 422 | + $this->set(($v[$c][0] - $i), $v[$c][1], false, $this::M_SEPARATOR); |
|
| 423 | 423 | } |
| 424 | 424 | } |
| 425 | 425 | |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | for($y = 0; $y < $this->moduleCount; $y++){ |
| 648 | 648 | for($x = 0; $x < $this->moduleCount; $x++){ |
| 649 | 649 | // out of bounds, skip |
| 650 | - if($x < $start || $y < $start ||$x >= $end || $y >= $end){ |
|
| 650 | + if($x < $start || $y < $start || $x >= $end || $y >= $end){ |
|
| 651 | 651 | continue; |
| 652 | 652 | } |
| 653 | 653 | // a match |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | |
| 717 | 717 | foreach($this->matrix as $y => $row){ |
| 718 | 718 | foreach($row as $x => $val){ |
| 719 | - if($mask($x, $y) && ($val & $this::M_DATA) === $this::M_DATA){ |
|
| 719 | + if($mask($x, $y) && ($val&$this::M_DATA) === $this::M_DATA){ |
|
| 720 | 720 | $this->flip($x, $y); |
| 721 | 721 | } |
| 722 | 722 | } |