smiley 10 лет назад
Родитель
Сommit
645d32c062
1 измененных файлов с 5 добавлено и 6 удалено
  1. 5 6
      src/QRCode.php

+ 5 - 6
src/QRCode.php

@@ -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.');
 		}