:octocat: fall back to defaults if nothing is given

This commit is contained in:
smiley
2017-12-20 19:50:52 +01:00
parent ea007a1086
commit c5ef9a5ab6
+6 -1
View File
@@ -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