options overall optional

This commit is contained in:
smiley
2015-12-11 03:07:38 +01:00
parent 98dc126cf8
commit 645d32c062
+5 -6
View File
@@ -92,11 +92,6 @@ class QRCode{
public function __construct($data, QROutputInterface $output, QROptions $options = null){
$this->qrOutputInterface = $output;
$this->bitBuffer = new BitBuffer;
if(!$options instanceof QROptions){
$options = new QROptions;
}
$this->setData($data, $options);
}
@@ -107,9 +102,13 @@ class QRCode{
* @return $this
* @throws \chillerlan\QRCode\QRCodeException
*/
public function setData($data, QROptions $options){
public function setData($data, QROptions $options = null){
$data = trim($data);
if(!$options instanceof QROptions){
$options = new QROptions;
}
if(empty($data)){
throw new QRCodeException('No data given.');
}