:octocat: +eec string representation

This commit is contained in:
codemasher
2021-01-07 12:19:13 +01:00
parent 28d116f4e4
commit eb2ec6f089
+15 -1
View File
@@ -37,7 +37,7 @@ final class EccLevel{
*
* @see \chillerlan\QRCode\Common\Version::MAX_BITS
* @see \chillerlan\QRCode\Common\EccLevel::RSBLOCKS
* @see \chillerlan\QRCode\Data\QRMatrix::formatPattern
* @see \chillerlan\QRCode\Common\EccLevel::formatPattern
*
* @var int[]
*/
@@ -48,6 +48,13 @@ final class EccLevel{
self::H => 3,
];
public const MODES_STRING = [
self::L => 'L',
self::M => 'M',
self::Q => 'Q',
self::H => 'H',
];
/**
* ISO/IEC 18004:2000 Tables 13-22
*
@@ -213,6 +220,13 @@ final class EccLevel{
$this->eccLevel = $eccLevel;
}
/**
* returns the string representation of the current ECC level
*/
public function __toString():string{
return self::MODES_STRING[$this->eccLevel];
}
/**
* returns the current ECC level
*/