mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-26 03:58:07 +00:00
:octocat: yo scrunitizer
This commit is contained in:
@@ -65,8 +65,8 @@ class Polynomial{
|
||||
/**
|
||||
* Polynomial constructor.
|
||||
*
|
||||
* @param array $num
|
||||
* @param int $shift
|
||||
* @param array|null $num
|
||||
* @param int|null $shift
|
||||
*/
|
||||
public function __construct(array $num = null, int $shift = null){
|
||||
$this->setNum($num ?? [1], $shift);
|
||||
@@ -80,8 +80,8 @@ class Polynomial{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $num
|
||||
* @param int $shift
|
||||
* @param array $num
|
||||
* @param int|null $shift
|
||||
*
|
||||
* @return \chillerlan\QRCode\Helpers\Polynomial
|
||||
*/
|
||||
|
||||
@@ -24,6 +24,8 @@ class QRImage extends QROutputAbstract{
|
||||
QRCode::OUTPUT_IMAGE_GIF,
|
||||
];
|
||||
|
||||
protected $defaultMode = QRCode::OUTPUT_IMAGE_PNG;
|
||||
|
||||
protected $moduleValues = [
|
||||
// light
|
||||
QRMatrix::M_DATA => [255, 255, 255],
|
||||
@@ -140,7 +142,7 @@ class QRImage extends QROutputAbstract{
|
||||
ob_start();
|
||||
|
||||
try{
|
||||
call_user_func([$this, $this->outputMode ?? QRCode::OUTPUT_IMAGE_PNG]);
|
||||
call_user_func([$this, $this->outputMode ?? $this->defaultMode]);
|
||||
}
|
||||
// not going to cover edge cases
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
+1
-13
@@ -19,19 +19,7 @@ use chillerlan\QRCode\QRCode;
|
||||
*/
|
||||
class QRMarkup extends QROutputAbstract{
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function dump(){
|
||||
|
||||
$data = call_user_func([$this, $this->outputMode ?? QRCode::OUTPUT_MARKUP_SVG]);
|
||||
|
||||
if($this->options->cachefile !== null){
|
||||
$this->saveToFile($data);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
protected $defaultMode = QRCode::OUTPUT_MARKUP_SVG;
|
||||
|
||||
/**
|
||||
* @return string|bool
|
||||
|
||||
@@ -41,6 +41,11 @@ abstract class QROutputAbstract implements QROutputInterface{
|
||||
*/
|
||||
protected $outputMode;
|
||||
|
||||
/**
|
||||
* @var string;
|
||||
*/
|
||||
protected $defaultMode;
|
||||
|
||||
/**
|
||||
* QROutputAbstract constructor.
|
||||
*
|
||||
@@ -77,4 +82,17 @@ abstract class QROutputAbstract implements QROutputInterface{
|
||||
return file_put_contents($this->options->cachefile, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function dump(){
|
||||
$data = call_user_func([$this, $this->outputMode ?? $this->defaultMode]);
|
||||
|
||||
if($this->options->cachefile !== null){
|
||||
$this->saveToFile($data);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-13
@@ -19,18 +19,7 @@ use chillerlan\QRCode\QRCode;
|
||||
*/
|
||||
class QRString extends QROutputAbstract{
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function dump():string{
|
||||
$data = call_user_func([$this, $this->outputMode ?? QRCode::OUTPUT_STRING_TEXT]);
|
||||
|
||||
if($this->options->cachefile !== null){
|
||||
$this->saveToFile($data);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
protected $defaultMode = QRCode::OUTPUT_STRING_TEXT;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
@@ -60,7 +49,10 @@ class QRString extends QROutputAbstract{
|
||||
return implode($this->options->eol, $str);
|
||||
}
|
||||
|
||||
protected function json(){
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function json():string{
|
||||
return json_encode($this->matrix->matrix());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user