@@ -143,7 +143,8 @@ |
||
| 143 | 143 | // This is a direct application of Chien's search |
| 144 | 144 | $numErrors = $errorLocator->getDegree(); |
| 145 | 145 | |
| 146 | - if($numErrors === 1){ // shortcut |
|
| 146 | + if($numErrors === 1){ |
|
| 147 | +// shortcut |
|
| 147 | 148 | return [$errorLocator->getCoefficient(1)]; |
| 148 | 149 | } |
| 149 | 150 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | [$numEccCodewords, $eccBlocks] = $this->version->getRSBlocks($this->eccLevel); |
| 79 | 79 | |
| 80 | 80 | // Now establish DataBlocks of the appropriate size and number of data codewords |
| 81 | - $result = [];//new DataBlock[$totalBlocks]; |
|
| 81 | + $result = []; //new DataBlock[$totalBlocks]; |
|
| 82 | 82 | $numResultBlocks = 0; |
| 83 | 83 | |
| 84 | 84 | foreach($eccBlocks as $blockData){ |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | // Above should work but fails on some Apple and Linux JDKs due to a Hotspot bug. |
| 305 | 305 | // Below is a funny-looking workaround from Steven Parkes |
| 306 | 306 | $term = GF256::multiply($errorLocations[$j], $xiInverse); |
| 307 | - $denominator = GF256::multiply($denominator, ((($term & 0x1) === 0) ? ($term | 1) : ($term & ~1))); |
|
| 307 | + $denominator = GF256::multiply($denominator, ((($term & 0x1) === 0) ? ($term|1) : ($term & ~1))); |
|
| 308 | 308 | } |
| 309 | 309 | } |
| 310 | 310 | |
@@ -59,7 +59,8 @@ |
||
| 59 | 59 | $estAlignmentY = (int)($topLeft->getY() + $correctionToTopLeft * ($bottomRightY - $topLeft->getY())); |
| 60 | 60 | |
| 61 | 61 | // Kind of arbitrary -- expand search radius before giving up |
| 62 | - for($i = 4; $i <= 16; $i <<= 1){//?????????? |
|
| 62 | + for($i = 4; $i <= 16; $i <<= 1){ |
|
| 63 | +//?????????? |
|
| 63 | 64 | $alignmentPattern = $this->findAlignmentInRegion($moduleSize, $estAlignmentX, $estAlignmentY, (float)$i); |
| 64 | 65 | |
| 65 | 66 | if($alignmentPattern !== null){ |
@@ -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->size(); |
| 282 | 282 | $allowance = (int)($allowanceFactor * $overallEstModuleSize); |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | protected function setLuminancePixels():void{ |
| 61 | 61 | |
| 62 | 62 | if($this->options->readerGrayscale){ |
| 63 | - imagefilter($this->gdImage, IMG_FILTER_GRAYSCALE); |
|
| 63 | + imagefilter($this->gdImage, IMG_FILTER_GRAYSCALE); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | if($this->options->readerIncreaseContrast){ |
@@ -153,7 +153,8 @@ |
||
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | // @codeCoverageIgnoreStart |
| 156 | - catch(Throwable $aioobe){//ArrayIndexOutOfBoundsException |
|
| 156 | + catch(Throwable $aioobe){ |
|
| 157 | +//ArrayIndexOutOfBoundsException |
|
| 157 | 158 | // This feels wrong, but, sometimes if the finder patterns are misidentified, the resulting |
| 158 | 159 | // transform gets "twisted" such that it maps a straight line of points to a set of points |
| 159 | 160 | // whose endpoints are in bounds, but others are not. There is probably some mathematical |
@@ -85,7 +85,8 @@ |
||
| 85 | 85 | |
| 86 | 86 | if($this->matrix->check($j, $i)){ |
| 87 | 87 | // Black pixel |
| 88 | - if($currentState === 1){ // Counting black pixels |
|
| 88 | + if($currentState === 1){ |
|
| 89 | +// Counting black pixels |
|
| 89 | 90 | $stateCount[$currentState]++; |
| 90 | 91 | } |
| 91 | 92 | // Counting white pixels |
@@ -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; |
@@ -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->size(); |
| 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->size(); |
| 419 | 419 | $stateCount = $this->getCrossCheckStateCount(); |
| 420 | 420 | |
@@ -457,7 +457,7 @@ |
||
| 457 | 457 | /** |
| 458 | 458 | * clamp the logo space values between 0 and maximum length (177 modules at version 40) |
| 459 | 459 | */ |
| 460 | - protected function clampLogoSpaceValue(?int $value):?int{ |
|
| 460 | + protected function clampLogoSpaceValue(?int $value): ?int{ |
|
| 461 | 461 | |
| 462 | 462 | if($value === null){ |
| 463 | 463 | return null; |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @see \chillerlan\QRCode\Common\Version::AUTO |
| 36 | 36 | * @var int |
| 37 | 37 | */ |
| 38 | - public const VERSION_AUTO = Version::AUTO; |
|
| 38 | + public const VERSION_AUTO = Version::AUTO; |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * @deprecated 5.0.0 use MaskPattern::AUTO instead |
@@ -84,28 +84,28 @@ discard block |
||
| 84 | 84 | * @see \chillerlan\QRCode\Output\QROutputInterface::MARKUP_SVG |
| 85 | 85 | * @var string |
| 86 | 86 | */ |
| 87 | - public const OUTPUT_MARKUP_SVG = QROutputInterface::MARKUP_SVG; |
|
| 87 | + public const OUTPUT_MARKUP_SVG = QROutputInterface::MARKUP_SVG; |
|
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | 90 | * @deprecated 5.0.0 use QROutputInterface::GDIMAGE_PNG instead |
| 91 | 91 | * @see \chillerlan\QRCode\Output\QROutputInterface::GDIMAGE_PNG |
| 92 | 92 | * @var string |
| 93 | 93 | */ |
| 94 | - public const OUTPUT_IMAGE_PNG = QROutputInterface::GDIMAGE_PNG; |
|
| 94 | + public const OUTPUT_IMAGE_PNG = QROutputInterface::GDIMAGE_PNG; |
|
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | 97 | * @deprecated 5.0.0 use QROutputInterface::GDIMAGE_JPG instead |
| 98 | 98 | * @see \chillerlan\QRCode\Output\QROutputInterface::GDIMAGE_JPG |
| 99 | 99 | * @var string |
| 100 | 100 | */ |
| 101 | - public const OUTPUT_IMAGE_JPG = QROutputInterface::GDIMAGE_JPG; |
|
| 101 | + public const OUTPUT_IMAGE_JPG = QROutputInterface::GDIMAGE_JPG; |
|
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * @deprecated 5.0.0 use QROutputInterface::GDIMAGE_GIF instead |
| 105 | 105 | * @see \chillerlan\QRCode\Output\QROutputInterface::GDIMAGE_GIF |
| 106 | 106 | * @var string |
| 107 | 107 | */ |
| 108 | - public const OUTPUT_IMAGE_GIF = QROutputInterface::GDIMAGE_GIF; |
|
| 108 | + public const OUTPUT_IMAGE_GIF = QROutputInterface::GDIMAGE_GIF; |
|
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | 111 | * @deprecated 5.0.0 use QROutputInterface::STRING_JSON instead |
@@ -126,35 +126,35 @@ discard block |
||
| 126 | 126 | * @see \chillerlan\QRCode\Output\QROutputInterface::IMAGICK |
| 127 | 127 | * @var string |
| 128 | 128 | */ |
| 129 | - public const OUTPUT_IMAGICK = QROutputInterface::IMAGICK; |
|
| 129 | + public const OUTPUT_IMAGICK = QROutputInterface::IMAGICK; |
|
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | 132 | * @deprecated 5.0.0 use QROutputInterface::FPDF instead |
| 133 | 133 | * @see \chillerlan\QRCode\Output\QROutputInterface::FPDF |
| 134 | 134 | * @var string |
| 135 | 135 | */ |
| 136 | - public const OUTPUT_FPDF = QROutputInterface::FPDF; |
|
| 136 | + public const OUTPUT_FPDF = QROutputInterface::FPDF; |
|
| 137 | 137 | |
| 138 | 138 | /** |
| 139 | 139 | * @deprecated 5.0.0 use QROutputInterface::EPS instead |
| 140 | 140 | * @see \chillerlan\QRCode\Output\QROutputInterface::EPS |
| 141 | 141 | * @var string |
| 142 | 142 | */ |
| 143 | - public const OUTPUT_EPS = QROutputInterface::EPS; |
|
| 143 | + public const OUTPUT_EPS = QROutputInterface::EPS; |
|
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | 146 | * @deprecated 5.0.0 use QROutputInterface::CUSTOM instead |
| 147 | 147 | * @see \chillerlan\QRCode\Output\QROutputInterface::CUSTOM |
| 148 | 148 | * @var string |
| 149 | 149 | */ |
| 150 | - public const OUTPUT_CUSTOM = QROutputInterface::CUSTOM; |
|
| 150 | + public const OUTPUT_CUSTOM = QROutputInterface::CUSTOM; |
|
| 151 | 151 | |
| 152 | 152 | /** |
| 153 | 153 | * @deprecated 5.0.0 use QROutputInterface::MODES instead |
| 154 | 154 | * @see \chillerlan\QRCode\Output\QROutputInterface::MODES |
| 155 | 155 | * @var string[] |
| 156 | 156 | */ |
| 157 | - public const OUTPUT_MODES = QROutputInterface::MODES; |
|
| 157 | + public const OUTPUT_MODES = QROutputInterface::MODES; |
|
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | 160 | * The settings container |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | * @throws \chillerlan\QRCode\Output\QRCodeOutputException |
| 272 | 272 | */ |
| 273 | 273 | protected function initOutputInterface(QRMatrix $matrix):QROutputInterface{ |
| 274 | - $outputInterface =( QROutputInterface::MODES[$this->options->outputType] ?? null); |
|
| 274 | + $outputInterface = (QROutputInterface::MODES[$this->options->outputType] ?? null); |
|
| 275 | 275 | |
| 276 | 276 | if($this->options->outputType === QROutputInterface::CUSTOM){ |
| 277 | 277 | $outputInterface = $this->options->outputInterface; |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | // This class uses 5x5 blocks to compute local luminance, where each block is 8x8 pixels. |
| 37 | 37 | // So this is the smallest dimension in each axis we can accept. |
| 38 | 38 | private const BLOCK_SIZE_POWER = 3; |
| 39 | - private const BLOCK_SIZE = 8; // ...0100...00 |
|
| 40 | - private const BLOCK_SIZE_MASK = 7; // ...0011...11 |
|
| 39 | + private const BLOCK_SIZE = 8; // ...0100...00 |
|
| 40 | + private const BLOCK_SIZE_MASK = 7; // ...0011...11 |
|
| 41 | 41 | private const MINIMUM_DIMENSION = 40; |
| 42 | 42 | private const MIN_DYNAMIC_RANGE = 24; |
| 43 | 43 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | for($xx = 0; $xx < self::BLOCK_SIZE; $xx++){ |
| 236 | 236 | $pixel = ((int)($this->luminances[(int)($offset + $xx)]) & 0xff); |
| 237 | - $sum += $pixel; |
|
| 237 | + $sum += $pixel; |
|
| 238 | 238 | // still looking for good contrast |
| 239 | 239 | if($pixel < $min){ |
| 240 | 240 | $min = $pixel; |