:octocat:

This commit is contained in:
smiley
2022-11-09 20:58:41 +01:00
parent e2707049cd
commit 92fb9728c8
+5 -2
View File
@@ -380,17 +380,20 @@ trait QROptionsTrait{
* sets/clamps the version number
*/
protected function set_version(int $version):void{
$this->version = $version !== Version::AUTO ? max(1, min(40, $version)) : Version::AUTO; // @todo
$this->version = $version !== Version::AUTO ? max(1, min(40, $version)) : Version::AUTO;
}
/**
* sets the error correction level
*
* @todo: accept string values (PHP8+)
* @see https://github.com/chillerlan/php-qrcode/discussions/160
*
* @throws \chillerlan\QRCode\QRCodeException
*/
protected function set_eccLevel(int $eccLevel):void{
if(!in_array($eccLevel, [EccLevel::L, EccLevel::M, EccLevel::Q, EccLevel::H], true)){
if((0b11 & $eccLevel) !== $eccLevel){
throw new QRCodeException(sprintf('Invalid error correct level: %s', $eccLevel));
}