mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-30 03:58:28 +00:00
🚿
This commit is contained in:
@@ -212,6 +212,9 @@ class EccLevel{
|
||||
$this->eccLevel = $eccLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the ordinal value of the current ECC level
|
||||
*/
|
||||
public function getOrdinal():int{
|
||||
return $this->eccLevel;
|
||||
}
|
||||
@@ -234,7 +237,6 @@ class EccLevel{
|
||||
/**
|
||||
* returns the format pattern for the given $eccLevel and $maskPattern
|
||||
*
|
||||
* @return int
|
||||
* @throws \chillerlan\QRCode\QRCodeException
|
||||
*/
|
||||
public function getformatPattern(int $maskPattern):int{
|
||||
@@ -246,6 +248,9 @@ class EccLevel{
|
||||
return self::formatPattern[self::MODES[$this->eccLevel]][$maskPattern];
|
||||
}
|
||||
|
||||
/**
|
||||
* returns an array wit the max bit lengths for version 1-40 and the current ECC level
|
||||
*/
|
||||
public function getMaxBits():array{
|
||||
return array_combine(
|
||||
array_keys(self::MAX_BITS),
|
||||
|
||||
+4
-4
@@ -59,10 +59,10 @@ class Mode{
|
||||
* @var string[]
|
||||
*/
|
||||
public const DATA_INTERFACES = [
|
||||
Mode::DATA_NUMBER => Number::class,
|
||||
Mode::DATA_ALPHANUM => AlphaNum::class,
|
||||
Mode::DATA_KANJI => Kanji::class,
|
||||
Mode::DATA_BYTE => Byte::class,
|
||||
self::DATA_NUMBER => Number::class,
|
||||
self::DATA_ALPHANUM => AlphaNum::class,
|
||||
self::DATA_KANJI => Kanji::class,
|
||||
self::DATA_BYTE => Byte::class,
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -132,18 +132,32 @@ class Version{
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the current version number
|
||||
*/
|
||||
public function getVersionNumber():int{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
/**
|
||||
* the matrix size for the given version
|
||||
*/
|
||||
public function getDimension():int{
|
||||
return $this->version * 4 + 17;
|
||||
}
|
||||
|
||||
/**
|
||||
* the version pattern for the given version
|
||||
*/
|
||||
public function getVersionPattern():?int{
|
||||
return self::VERSION_PATTERN[$this->version] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* the alignment patterns for the current version
|
||||
*
|
||||
* @return int[]
|
||||
*/
|
||||
public function getAlignmentPattern():array{
|
||||
return self::ALIGNMENT_PATTERN[$this->version];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user