mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-17 12:13:05 +00:00
added QRCodeDataException
This commit is contained in:
+3
-4
@@ -13,7 +13,6 @@
|
||||
namespace chillerlan\QRCode\Data;
|
||||
|
||||
use chillerlan\QRCode\BitBuffer;
|
||||
use chillerlan\QRCode\QRCodeException;
|
||||
use chillerlan\QRCode\QRConst;
|
||||
|
||||
/**
|
||||
@@ -34,7 +33,7 @@ class Kanji extends QRDataBase implements QRDataInterface{
|
||||
/**
|
||||
* @param \chillerlan\QRCode\BitBuffer $buffer
|
||||
*
|
||||
* @throws \chillerlan\QRCode\QRCodeException
|
||||
* @throws \chillerlan\QRCode\Data\QRCodeDataException
|
||||
*/
|
||||
public function write(BitBuffer &$buffer){
|
||||
|
||||
@@ -49,7 +48,7 @@ class Kanji extends QRDataBase implements QRDataInterface{
|
||||
$c -= 0xC140;
|
||||
}
|
||||
else{
|
||||
throw new QRCodeException('illegal char at '.($i + 1).' ('.$c.')');
|
||||
throw new QRCodeDataException('illegal char at '.($i + 1).' ('.$c.')');
|
||||
}
|
||||
|
||||
$buffer->put((($c >> 8)&0xff) * 0xC0 + ($c&0xff), 13);
|
||||
@@ -57,7 +56,7 @@ class Kanji extends QRDataBase implements QRDataInterface{
|
||||
}
|
||||
|
||||
if($i < $this->dataLength){
|
||||
throw new QRCodeException('illegal char at '.($i + 1));
|
||||
throw new QRCodeDataException('illegal char at '.($i + 1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Class QRCodeDataException
|
||||
*
|
||||
* @filesource QRCodeDataException.php
|
||||
* @created 09.12.2015
|
||||
* @package chillerlan\QRCode\Data
|
||||
* @author Smiley <smiley@chillerlan.net>
|
||||
* @copyright 2015 Smiley
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
namespace chillerlan\QRCode\Data;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
class QRCodeDataException extends Exception{
|
||||
|
||||
}
|
||||
@@ -12,8 +12,6 @@
|
||||
|
||||
namespace chillerlan\QRCode\Data;
|
||||
|
||||
use chillerlan\QRCode\QRCodeException;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -48,7 +46,7 @@ class QRDataBase{
|
||||
* @param int $type
|
||||
*
|
||||
* @return int
|
||||
* @throws \chillerlan\QRCode\QRCodeException
|
||||
* @throws \chillerlan\QRCode\Data\QRCodeDataException
|
||||
*/
|
||||
public function getLengthInBits($type){
|
||||
|
||||
@@ -57,7 +55,7 @@ class QRDataBase{
|
||||
case $type <= 26 : return $this->lengthBits[1]; // 10 - 26
|
||||
case $type <= 40 : return $this->lengthBits[2]; // 27 - 40
|
||||
default:
|
||||
throw new QRCodeException('$type: '.$type);
|
||||
throw new QRCodeDataException('$type: '.$type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ interface QRDataInterface{
|
||||
* @param $type
|
||||
*
|
||||
* @return int
|
||||
* @throws \chillerlan\QRCode\QRCodeException
|
||||
* @throws \chillerlan\QRCode\Data\QRCodeDataException
|
||||
*/
|
||||
public function getLengthInBits($type);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user