🛀 too many static calls in here

This commit is contained in:
smiley
2025-11-14 21:01:37 +01:00
parent c99f5d4022
commit 490cc43b47
12 changed files with 67 additions and 57 deletions
+7 -7
View File
@@ -44,7 +44,7 @@ final class AlphaNum extends QRDataModeAbstract{
$bitBuffer
->put(self::DATAMODE, 4)
->put($len, $this::getLengthBits($versionNumber))
->put($len, $this->getLengthBits($versionNumber))
;
// encode 2 characters in 11 bits
@@ -68,8 +68,8 @@ final class AlphaNum extends QRDataModeAbstract{
*
* @throws \chillerlan\QRCode\Data\QRCodeDataException
*/
public static function decodeSegment(BitBuffer $bitBuffer, int $versionNumber):string{
$length = $bitBuffer->read(self::getLengthBits($versionNumber));
public function decodeSegment(BitBuffer $bitBuffer, int $versionNumber):string{
$length = $bitBuffer->read($this->getLengthBits($versionNumber));
$result = '';
// Read two characters at a time
while($length > 1){
@@ -79,8 +79,8 @@ final class AlphaNum extends QRDataModeAbstract{
}
$nextTwoCharsBits = $bitBuffer->read(11);
$result .= self::chr(intdiv($nextTwoCharsBits, 45));
$result .= self::chr($nextTwoCharsBits % 45);
$result .= $this->chr(intdiv($nextTwoCharsBits, 45));
$result .= $this->chr($nextTwoCharsBits % 45);
$length -= 2;
}
@@ -90,7 +90,7 @@ final class AlphaNum extends QRDataModeAbstract{
throw new QRCodeDataException('not enough bits available'); // @codeCoverageIgnore
}
$result .= self::chr($bitBuffer->read(6));
$result .= $this->chr($bitBuffer->read(6));
}
return $result;
@@ -113,7 +113,7 @@ final class AlphaNum extends QRDataModeAbstract{
/**
* @throws \chillerlan\QRCode\Data\QRCodeDataException
*/
private static function chr(int $ord):string{
private function chr(int $ord):string{
if($ord < 0 || $ord > 44){
throw new QRCodeDataException('invalid character code'); // @codeCoverageIgnore