|
@@ -105,14 +105,14 @@ class QRCode{
|
|
|
public function setData($data, QROptions $options = null){
|
|
public function setData($data, QROptions $options = null){
|
|
|
$data = trim($data);
|
|
$data = trim($data);
|
|
|
|
|
|
|
|
- if(!$options instanceof QROptions){
|
|
|
|
|
- $options = new QROptions;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
if(empty($data)){
|
|
if(empty($data)){
|
|
|
throw new QRCodeException('No data given.');
|
|
throw new QRCodeException('No data given.');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if(!$options instanceof QROptions){
|
|
|
|
|
+ $options = new QROptions;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if(!array_key_exists($options->errorCorrectLevel, QRConst::RSBLOCK)){
|
|
if(!array_key_exists($options->errorCorrectLevel, QRConst::RSBLOCK)){
|
|
|
throw new QRCodeException('Invalid error correct level: '.$options->errorCorrectLevel);
|
|
throw new QRCodeException('Invalid error correct level: '.$options->errorCorrectLevel);
|
|
|
}
|
|
}
|