mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-30 12:07:32 +00:00
🚿 consistency: renamed constants QRDataInterface::*_CHAR_MAP -> CHAR_MAP_*
This commit is contained in:
@@ -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;
|
||||
|
||||
+1
-1
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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',
|
||||
|
||||
+2
-2
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user