mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-10-15 08:16:28 +00:00
Merge branch 'master' into php-7.4
# Conflicts: # composer.json # src/Output/QROutputAbstract.php # src/QROptionsTrait.php
This commit is contained in:
@@ -15,6 +15,8 @@ namespace chillerlan\QRCode\Output;
|
||||
use chillerlan\QRCode\{Data\QRMatrix, QRCode};
|
||||
use chillerlan\Settings\SettingsContainerInterface;
|
||||
|
||||
use function call_user_func, dirname, file_put_contents, get_called_class, in_array, is_writable, sprintf;
|
||||
|
||||
/**
|
||||
* common output abstract
|
||||
*/
|
||||
@@ -46,9 +48,9 @@ abstract class QROutputAbstract implements QROutputInterface{
|
||||
$this->scale = $this->options->scale;
|
||||
$this->length = $this->moduleCount * $this->scale;
|
||||
|
||||
$class = \get_called_class();
|
||||
$class = get_called_class();
|
||||
|
||||
if(\array_key_exists($class, QRCode::OUTPUT_MODES) && \in_array($this->options->outputType, QRCode::OUTPUT_MODES[$class])){
|
||||
if(isset(QRCode::OUTPUT_MODES[$class]) && in_array($this->options->outputType, QRCode::OUTPUT_MODES[$class])){
|
||||
$this->outputMode = $this->options->outputType;
|
||||
}
|
||||
|
||||
@@ -67,18 +69,18 @@ abstract class QROutputAbstract implements QROutputInterface{
|
||||
*/
|
||||
protected function saveToFile(string $data, string $file):bool{
|
||||
|
||||
if(!\is_writable(\dirname($file))){
|
||||
throw new QRCodeOutputException('Could not write data to cache file: '.$file);
|
||||
if(!is_writable(dirname($file))){
|
||||
throw new QRCodeOutputException(sprintf('Could not write data to cache file: %s', $file));
|
||||
}
|
||||
|
||||
return (bool)\file_put_contents($file, $data);
|
||||
return (bool)file_put_contents($file, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function dump(string $file = null){
|
||||
$data = \call_user_func([$this, $this->outputMode ?? $this->defaultMode]);
|
||||
$data = call_user_func([$this, $this->outputMode ?? $this->defaultMode]);
|
||||
$file ??= $this->options->cachefile;
|
||||
|
||||
if($file !== null){
|
||||
|
||||
Reference in New Issue
Block a user