diff --git a/src/Common/EccLevel.php b/src/Common/EccLevel.php index 1c8693822..b1247f822 100644 --- a/src/Common/EccLevel.php +++ b/src/Common/EccLevel.php @@ -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 */