-
-
Notifications
You must be signed in to change notification settings - Fork 303
/
QRMarkup.php
46 lines (37 loc) · 1.02 KB
/
QRMarkup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
* Class QRMarkup
*
* @created 17.12.2016
* @author Smiley <[email protected]>
* @copyright 2016 Smiley
* @license MIT
*/
declare(strict_types=1);
namespace chillerlan\QRCode\Output;
/**
* Abstract for markup types: HTML, SVG, ... XML anyone?
*/
abstract class QRMarkup extends QROutputAbstract{
use CssColorModuleValueTrait;
public function dump(string|null $file = null):string{
$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;
}
/**
* returns a string with all css classes for the current element
*/
protected function getCssClass(int $M_TYPE = 0):string{
return $this->options->cssClass;
}
/**
* returns the fully parsed and rendered markup string for the given input
*/
abstract protected function createMarkup(bool $saveToFile):string;
}