:octocat: forgot about these... 💄

This commit is contained in:
codemasher
2018-10-01 13:36:56 +02:00
parent 5e316540a1
commit cdde12f89c
4 changed files with 15 additions and 15 deletions
+1 -10
View File
@@ -19,15 +19,6 @@ use chillerlan\QRCode\QRCode;
*/
class AlphaNum extends QRDataAbstract{
public const CHAR_MAP = [
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
'W', 'X', 'Y', 'Z', ' ', '$', '%', '*',
'+', '-', '.', '/', ':',
];
/**
* @inheritdoc
*/
@@ -60,7 +51,7 @@ class AlphaNum extends QRDataAbstract{
* @throws \chillerlan\QRCode\Data\QRCodeDataException
*/
protected function getCharCode(string $chr):int{
$i = array_search($chr, $this::CHAR_MAP);
$i = array_search($chr, $this::ALPHANUM_CHAR_MAP);
if($i !== false){
return $i;
+1 -3
View File
@@ -19,8 +19,6 @@ use chillerlan\QRCode\QRCode;
*/
class Number extends QRDataAbstract{
public const CHAR_MAP = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
/**
* @inheritdoc
*/
@@ -70,7 +68,7 @@ class Number extends QRDataAbstract{
for($i = 0; $i < $len; $i++){
$c = ord($string[$i]);
if(!in_array($string[$i], $this::CHAR_MAP, true)){
if(!in_array($string[$i], $this::NUMBER_CHAR_MAP, true)){
throw new QRCodeDataException('illegal char: "'.$string[$i].'" ['.$c.']');
}
+11
View File
@@ -17,6 +17,17 @@ namespace chillerlan\QRCode\Data;
*/
interface QRDataInterface{
const NUMBER_CHAR_MAP = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
const ALPHANUM_CHAR_MAP = [
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
'W', 'X', 'Y', 'Z', ' ', '$', '%', '*',
'+', '-', '.', '/', ':',
];
/**
* @link http://www.qrcode.com/en/about/version.html
*/
+2 -2
View File
@@ -230,7 +230,7 @@ class QRCode{
* @return bool
*/
public function isNumber(string $string):bool{
return $this->checkString($string, Number::CHAR_MAP);
return $this->checkString($string, QRDataInterface::NUMBER_CHAR_MAP);
}
/**
@@ -241,7 +241,7 @@ class QRCode{
* @return bool
*/
public function isAlphaNum(string $string):bool{
return $this->checkString($string, AlphaNum::CHAR_MAP);
return $this->checkString($string, QRDataInterface::ALPHANUM_CHAR_MAP);
}
/**