diff --git a/src/Data/AlphaNum.php b/src/Data/AlphaNum.php index ec86e471d..cb9c89371 100644 --- a/src/Data/AlphaNum.php +++ b/src/Data/AlphaNum.php @@ -44,7 +44,7 @@ class AlphaNum extends QRDataAbstract{ * @throws \chillerlan\QRCode\Data\QRCodeDataException */ protected function getCharCode(string $chr):int{ - $i = array_search($chr, $this::ALPHANUM_CHAR_MAP); + $i = array_search($chr, $this::CHAR_MAP_ALPHANUM); if($i !== false){ return $i; diff --git a/src/Data/Number.php b/src/Data/Number.php index d0b33619a..b97a6a564 100644 --- a/src/Data/Number.php +++ b/src/Data/Number.php @@ -59,7 +59,7 @@ class Number extends QRDataAbstract{ for($i = 0; $i < $len; $i++){ $c = ord($string[$i]); - if(!in_array($string[$i], $this::NUMBER_CHAR_MAP, true)){ + if(!in_array($string[$i], $this::CHAR_MAP_NUMBER, true)){ throw new QRCodeDataException(sprintf('illegal char: "%s" [%d]', $string[$i], $c)); } diff --git a/src/Data/QRDataInterface.php b/src/Data/QRDataInterface.php index 936374a4f..9d0f40d13 100644 --- a/src/Data/QRDataInterface.php +++ b/src/Data/QRDataInterface.php @@ -17,9 +17,12 @@ namespace chillerlan\QRCode\Data; */ interface QRDataInterface{ - const NUMBER_CHAR_MAP = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; + const CHAR_MAP_NUMBER = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; - const ALPHANUM_CHAR_MAP = [ + /** + * ISO/IEC 18004:2000 Table 5 + */ + const CHAR_MAP_ALPHANUM = [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', diff --git a/src/QRCode.php b/src/QRCode.php index ae0efef59..c29346d40 100755 --- a/src/QRCode.php +++ b/src/QRCode.php @@ -229,14 +229,14 @@ class QRCode{ * checks if a string qualifies as numeric */ public function isNumber(string $string):bool{ - return $this->checkString($string, QRDataInterface::NUMBER_CHAR_MAP); + return $this->checkString($string, QRDataInterface::CHAR_MAP_NUMBER); } /** * checks if a string qualifies as alphanumeric */ public function isAlphaNum(string $string):bool{ - return $this->checkString($string, QRDataInterface::ALPHANUM_CHAR_MAP); + return $this->checkString($string, QRDataInterface::CHAR_MAP_ALPHANUM); } /**