:octocat: QRMarkup: move base64 transformation to abstract

This commit is contained in:
smiley
2024-07-17 08:11:05 +02:00
parent 22869ae8e2
commit 8276d6d6fb
3 changed files with 7 additions and 11 deletions
+7 -1
View File
@@ -20,10 +20,16 @@ abstract class QRMarkup extends QROutputAbstract{
* @inheritDoc
*/
public function dump(string $file = null):string{
$data = $this->createMarkup($file !== null);
$saveToFile = $file !== null;
$data = $this->createMarkup($saveToFile);
$this->saveToFile($data, $file);
// transform to data URI only when not saving to file
if(!$saveToFile && $this->options->outputBase64){
return $this->toBase64DataURI($data);
}
return $data;
}
-5
View File
@@ -83,11 +83,6 @@ class QRMarkupSVG extends QRMarkup{
// close svg
$svg .= sprintf('%1$s</svg>%1$s', $this->eol);
// transform to data URI only when not saving to file
if(!$saveToFile && $this->options->outputBase64){
return $this->toBase64DataURI($svg);
}
return $svg;
}
-5
View File
@@ -61,11 +61,6 @@ class QRMarkupXML extends QRMarkup{
$xml = $this->dom->saveXML();
// transform to data URI only when not saving to file
if(!$saveToFile && $this->options->outputBase64){
return $this->toBase64DataURI($xml);
}
return $xml;
}