فهرست منبع

:octocat: fall back to defaults if nothing is given

smiley 8 سال پیش
والد
کامیت
c5ef9a5ab6
1فایلهای تغییر یافته به همراه6 افزوده شده و 1 حذف شده
  1. 6 1
      src/Output/QRMarkup.php

+ 6 - 1
src/Output/QRMarkup.php

@@ -42,7 +42,7 @@ class QRMarkup extends QROutputAbstract{
 			$html .= '<div>';
 
 			foreach($row as $pixel){
-				$html .= '<span style="background: '.($this->options->moduleValues[$pixel] ?? 'lightgrey').';"></span>';
+				$html .= '<span style="background: '.($this->options->moduleValues[$pixel] ?: 'lightgrey').';"></span>';
 			}
 
 			$html .= '</div>';
@@ -73,6 +73,11 @@ class QRMarkup extends QROutputAbstract{
 		// @todo: optimize -> see https://github.com/alexeyten/qr-image/blob/master/lib/vector.js
 		foreach($this->options->moduleValues as $key => $value){
 
+			// fallback
+			if(is_bool($value)){
+				$value = $value ? '#000' : '#fff';
+			}
+
 			// svg body
 			foreach($this->matrix->matrix() as $y => $row){
 				//we'll combine active blocks within a single row as a lightweight compression technique