From ee94d97890db238cf9cf252a579637fb659bf764 Mon Sep 17 00:00:00 2001 From: smiley Date: Wed, 9 Dec 2015 01:52:35 +0100 Subject: [PATCH] added QRCodeDataException --- src/Data/Kanji.php | 7 +++---- src/Data/QRCodeDataException.php | 22 ++++++++++++++++++++++ src/Data/QRDataBase.php | 6 ++---- src/Data/QRDataInterface.php | 2 +- 4 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 src/Data/QRCodeDataException.php diff --git a/src/Data/Kanji.php b/src/Data/Kanji.php index a4fb7829b..7b5ab649e 100644 --- a/src/Data/Kanji.php +++ b/src/Data/Kanji.php @@ -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)); } } diff --git a/src/Data/QRCodeDataException.php b/src/Data/QRCodeDataException.php new file mode 100644 index 000000000..2d1049ad2 --- /dev/null +++ b/src/Data/QRCodeDataException.php @@ -0,0 +1,22 @@ + + * @copyright 2015 Smiley + * @license MIT + */ + +namespace chillerlan\QRCode\Data; + +use Exception; + +/** + * Placeholder + */ +class QRCodeDataException extends Exception{ + +} diff --git a/src/Data/QRDataBase.php b/src/Data/QRDataBase.php index 47b910f7b..3c1ec6c69 100644 --- a/src/Data/QRDataBase.php +++ b/src/Data/QRDataBase.php @@ -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); } } diff --git a/src/Data/QRDataInterface.php b/src/Data/QRDataInterface.php index 2129fe3f5..c7fb7fb09 100644 --- a/src/Data/QRDataInterface.php +++ b/src/Data/QRDataInterface.php @@ -28,7 +28,7 @@ interface QRDataInterface{ * @param $type * * @return int - * @throws \chillerlan\QRCode\QRCodeException + * @throws \chillerlan\QRCode\Data\QRCodeDataException */ public function getLengthInBits($type);