src/Output/QRMarkup.php 1 location
|
@@ 25-40 (lines=16) @@
|
| 22 |
|
/** |
| 23 |
|
* @return string |
| 24 |
|
*/ |
| 25 |
|
public function dump(){ |
| 26 |
|
|
| 27 |
|
if($this->options->cachefile !== null && !is_writable(dirname($this->options->cachefile))){ |
| 28 |
|
throw new QRCodeOutputException('Could not write data to cache file: '.$this->options->cachefile); |
| 29 |
|
} |
| 30 |
|
|
| 31 |
|
$data = $this->options->outputType === QRCode::OUTPUT_MARKUP_HTML |
| 32 |
|
? $this->toHTML() |
| 33 |
|
: $this->toSVG(); |
| 34 |
|
|
| 35 |
|
if($this->options->cachefile !== null){ |
| 36 |
|
$this->saveToFile($data); |
| 37 |
|
} |
| 38 |
|
|
| 39 |
|
return $data; |
| 40 |
|
} |
| 41 |
|
|
| 42 |
|
/** |
| 43 |
|
* @return string|bool |
src/Output/QRString.php 1 location
|
@@ 25-41 (lines=17) @@
|
| 22 |
|
/** |
| 23 |
|
* @return string |
| 24 |
|
*/ |
| 25 |
|
public function dump():string{ |
| 26 |
|
|
| 27 |
|
$data = $this->options->outputType === QRCode::OUTPUT_STRING_JSON |
| 28 |
|
? json_encode($this->matrix->matrix()) |
| 29 |
|
: $this->toString(); |
| 30 |
|
|
| 31 |
|
if($this->options->cachefile !== null){ |
| 32 |
|
|
| 33 |
|
if(!is_writable(dirname($this->options->cachefile))){ |
| 34 |
|
throw new QRCodeOutputException('Could not write data to cache file: '.$this->options->cachefile); |
| 35 |
|
} |
| 36 |
|
|
| 37 |
|
$this->saveToFile($data); |
| 38 |
|
} |
| 39 |
|
|
| 40 |
|
return $data; |
| 41 |
|
} |
| 42 |
|
|
| 43 |
|
/** |
| 44 |
|
* @return string |