Skip to content

Commit 8276d6d

Browse files
committed
:octocat: QRMarkup: move base64 transformation to abstract
1 parent 22869ae commit 8276d6d

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

src/Output/QRMarkup.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,16 @@ abstract class QRMarkup extends QROutputAbstract{
2020
* @inheritDoc
2121
*/
2222
public function dump(string $file = null):string{
23-
$data = $this->createMarkup($file !== null);
23+
$saveToFile = $file !== null;
24+
$data = $this->createMarkup($saveToFile);
2425

2526
$this->saveToFile($data, $file);
2627

28+
// transform to data URI only when not saving to file
29+
if(!$saveToFile && $this->options->outputBase64){
30+
return $this->toBase64DataURI($data);
31+
}
32+
2733
return $data;
2834
}
2935

src/Output/QRMarkupSVG.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,6 @@ protected function createMarkup(bool $saveToFile):string{
8383
// close svg
8484
$svg .= sprintf('%1$s</svg>%1$s', $this->eol);
8585

86-
// transform to data URI only when not saving to file
87-
if(!$saveToFile && $this->options->outputBase64){
88-
return $this->toBase64DataURI($svg);
89-
}
90-
9186
return $svg;
9287
}
9388

src/Output/QRMarkupXML.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@ protected function createMarkup(bool $saveToFile):string{
6161

6262
$xml = $this->dom->saveXML();
6363

64-
// transform to data URI only when not saving to file
65-
if(!$saveToFile && $this->options->outputBase64){
66-
return $this->toBase64DataURI($xml);
67-
}
68-
6964
return $xml;
7065
}
7166

0 commit comments

Comments
 (0)