added QRCodeDataException

This commit is contained in:
smiley
2015-12-09 01:52:35 +01:00
parent 02d140d582
commit ee94d97890
4 changed files with 28 additions and 9 deletions
+3 -4
View File
@@ -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));
}
}
+22
View File
@@ -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{
}
+2 -4
View File
@@ -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);
}
}
+1 -1
View File
@@ -28,7 +28,7 @@ interface QRDataInterface{
* @param $type
*
* @return int
* @throws \chillerlan\QRCode\QRCodeException
* @throws \chillerlan\QRCode\Data\QRCodeDataException
*/
public function getLengthInBits($type);