mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-09-03 22:18:39 +00:00
options overall optional
This commit is contained in:
+5
-6
@@ -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.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user