mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-25 01:07:55 +00:00
:octocat: fix PHPCS config, add Slevomat rules
This commit is contained in:
@@ -50,9 +50,6 @@ final class Binarizer{
|
||||
/** @var int[] */
|
||||
private array $luminances;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function __construct(LuminanceSourceInterface $source){
|
||||
$this->source = $source;
|
||||
$this->luminances = $this->source->getLuminances();
|
||||
@@ -162,9 +159,6 @@ final class Binarizer{
|
||||
return $this->getHistogramBlackMatrix($width, $height);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function getHistogramBlackMatrix(int $width, int $height):BitMatrix{
|
||||
|
||||
// Quickly calculates the histogram by sampling four rows from the image. This proved to be
|
||||
|
||||
@@ -221,7 +221,7 @@ final class BitMatrix extends QRMatrix{
|
||||
// Try again by actually masking the pattern first.
|
||||
$formatInfo = $this->doDecodeFormatInformation(
|
||||
($formatInfoBits1 ^ $this::FORMAT_INFO_MASK_QR),
|
||||
($formatInfoBits2 ^ $this::FORMAT_INFO_MASK_QR)
|
||||
($formatInfoBits2 ^ $this::FORMAT_INFO_MASK_QR),
|
||||
);
|
||||
|
||||
// still nothing???
|
||||
@@ -237,9 +237,6 @@ final class BitMatrix extends QRMatrix{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function copyVersionBit(int $i, int $j, int $versionBits):int{
|
||||
|
||||
$bit = $this->mirror
|
||||
@@ -380,9 +377,6 @@ final class BitMatrix extends QRMatrix{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function uRShift(int $a, int $b):int{
|
||||
|
||||
if($b === 0){
|
||||
@@ -392,9 +386,6 @@ final class BitMatrix extends QRMatrix{
|
||||
return (($a >> $b) & ~((1 << (8 * PHP_INT_SIZE - 1)) >> ($b - 1)));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function numBitsDiffering(int $a, int $b):int{
|
||||
// a now has a 1 bit exactly where its bit differs with b's
|
||||
$a ^= $b;
|
||||
|
||||
@@ -27,9 +27,6 @@ use function chr, str_replace;
|
||||
*/
|
||||
final class Decoder{
|
||||
|
||||
/**
|
||||
* @var \chillerlan\QRCode\QROptions|\chillerlan\Settings\SettingsContainerInterface
|
||||
*/
|
||||
private SettingsContainerInterface|QROptions $options;
|
||||
private Version|null $version = null;
|
||||
private EccLevel|null $eccLevel = null;
|
||||
@@ -164,9 +161,6 @@ final class Decoder{
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function decodeAlphanumSegment(int $versionNumber, bool $fc1InEffect):string{
|
||||
$str = AlphaNum::decodeSegment($this->bitBuffer, $versionNumber);
|
||||
|
||||
|
||||
@@ -60,10 +60,7 @@ final class DecoderResult{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function __get(string $property){
|
||||
public function __get(string $property):mixed{
|
||||
|
||||
if(property_exists($this, $property)){
|
||||
return $this->{$property};
|
||||
@@ -72,16 +69,10 @@ final class DecoderResult{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function __toString():string{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function hasStructuredAppend():bool{
|
||||
return $this->structuredAppendParity >= 0 && $this->structuredAppendSequence >= 0;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ final class ReedSolomonDecoder{
|
||||
while($longerBlocksStartAt >= 0){
|
||||
$numCodewords = count($result[$longerBlocksStartAt][1]);
|
||||
|
||||
if($numCodewords == $shorterBlocksTotalCodewords){
|
||||
if($numCodewords === $shorterBlocksTotalCodewords){
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ final class ReedSolomonDecoder{
|
||||
[$sigma, $omega] = $this->runEuclideanAlgorithm(
|
||||
GF256::buildMonomial($numEccCodewords, 1),
|
||||
new GenericGFPoly(array_reverse($syndromeCoefficients)),
|
||||
$numEccCodewords
|
||||
$numEccCodewords,
|
||||
);
|
||||
|
||||
$errorLocations = $this->findErrorLocations($sigma);
|
||||
|
||||
Reference in New Issue
Block a user