mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-24 20:47:57 +00:00
:octocat: QRMarkup: move base64 transformation to abstract
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user