:octocat: rename QROutputAbstract::getModuleValue() to prepareModuleValue() to better reflect what it does

This commit is contained in:
smiley
2023-04-06 02:11:08 +02:00
parent 6b9f6f8459
commit a4ae0e959a
8 changed files with 19 additions and 19 deletions
+2 -2
View File
@@ -31,8 +31,8 @@ class MyCustomOutput extends QROutputAbstract{
/**
* @inheritDoc
*/
protected function getModuleValue($value){
// TODO: Implement getModuleValue() method. (abstract)
protected function prepareModuleValue($value){
// TODO: Implement prepareModuleValue() method. (abstract)
return null;
}
+1 -1
View File
@@ -52,7 +52,7 @@ class QREps extends QROutputAbstract{
*
* @inheritDoc
*/
protected function getModuleValue($value):array{
protected function prepareModuleValue($value):array{
$values = [];
foreach(array_values($value) as $i => $val){
+2 -2
View File
@@ -74,7 +74,7 @@ class QRFpdf extends QROutputAbstract{
*
* @inheritDoc
*/
protected function getModuleValue($value):array{
protected function prepareModuleValue($value):array{
$values = [];
foreach(array_values($value) as $i => $val){
@@ -107,7 +107,7 @@ class QRFpdf extends QROutputAbstract{
$fpdf->AddPage();
if($this::moduleValueIsValid($this->options->bgColor)){
$bgColor = $this->getModuleValue($this->options->bgColor);
$bgColor = $this->prepareModuleValue($this->options->bgColor);
/** @phan-suppress-next-line PhanParamTooFewUnpack */
$fpdf->SetFillColor(...$bgColor);
$fpdf->Rect(0, 0, $this->length, $this->length, 'F');
+5 -5
View File
@@ -110,7 +110,7 @@ class QRGdImage extends QROutputAbstract{
* @inheritDoc
* @throws \chillerlan\QRCode\Output\QRCodeOutputException
*/
protected function getModuleValue($value):int{
protected function prepareModuleValue($value):int{
$values = [];
foreach(array_values($value) as $i => $val){
@@ -136,7 +136,7 @@ class QRGdImage extends QROutputAbstract{
* @inheritDoc
*/
protected function getDefaultModuleValue(bool $isDark):int{
return $this->getModuleValue(($isDark) ? [0, 0, 0] : [255, 255, 255]);
return $this->prepareModuleValue(($isDark) ? [0, 0, 0] : [255, 255, 255]);
}
/**
@@ -199,12 +199,12 @@ class QRGdImage extends QROutputAbstract{
}
if($this::moduleValueIsValid($this->options->bgColor)){
$this->background = $this->getModuleValue($this->options->bgColor);
$this->background = $this->prepareModuleValue($this->options->bgColor);
return;
}
$this->background = $this->getModuleValue([255, 255, 255]);
$this->background = $this->prepareModuleValue([255, 255, 255]);
}
/**
@@ -219,7 +219,7 @@ class QRGdImage extends QROutputAbstract{
$transparencyColor = $this->background;
if($this::moduleValueIsValid($this->options->transparencyColor)){
$transparencyColor = $this->getModuleValue($this->options->transparencyColor);
$transparencyColor = $this->prepareModuleValue($this->options->transparencyColor);
}
imagecolortransparent($this->image, $transparencyColor);
+5 -5
View File
@@ -99,7 +99,7 @@ class QRImagick extends QROutputAbstract{
* @inheritDoc
* @throws \ImagickPixelException
*/
protected function getModuleValue($value):ImagickPixel{
protected function prepareModuleValue($value):ImagickPixel{
return new ImagickPixel($value);
}
@@ -107,7 +107,7 @@ class QRImagick extends QROutputAbstract{
* @inheritDoc
*/
protected function getDefaultModuleValue(bool $isDark):ImagickPixel{
return $this->getModuleValue(($isDark) ? $this->options->markupDark : $this->options->markupLight);
return $this->prepareModuleValue(($isDark) ? $this->options->markupDark : $this->options->markupLight);
}
/**
@@ -153,12 +153,12 @@ class QRImagick extends QROutputAbstract{
}
if($this::moduleValueIsValid($this->options->bgColor)){
$this->background = $this->getModuleValue($this->options->bgColor);
$this->background = $this->prepareModuleValue($this->options->bgColor);
return;
}
$this->background = $this->getModuleValue('white');
$this->background = $this->prepareModuleValue('white');
}
/**
@@ -173,7 +173,7 @@ class QRImagick extends QROutputAbstract{
$transparencyColor = $this->background;
if($this::moduleValueIsValid($this->options->transparencyColor)){
$transparencyColor = $this->getModuleValue($this->options->transparencyColor);
$transparencyColor = $this->prepareModuleValue($this->options->transparencyColor);
}
$this->imagick->transparentPaintImage($transparencyColor, 0.0, 10, false);
+1 -1
View File
@@ -57,7 +57,7 @@ abstract class QRMarkup extends QROutputAbstract{
/**
* @inheritDoc
*/
protected function getModuleValue($value):string{
protected function prepareModuleValue($value):string{
return trim(strip_tags($value), " '\"\r\n\t");
}
+2 -2
View File
@@ -85,7 +85,7 @@ abstract class QROutputAbstract implements QROutputInterface{
$value = ($this->options->moduleValues[$M_TYPE] ?? null);
$this->moduleValues[$M_TYPE] = $this::moduleValueIsValid($value)
? $this->getModuleValue($value)
? $this->prepareModuleValue($value)
: $this->getDefaultModuleValue($defaultValue);
}
@@ -98,7 +98,7 @@ abstract class QROutputAbstract implements QROutputInterface{
*
* @return mixed
*/
abstract protected function getModuleValue($value);
abstract protected function prepareModuleValue($value);
/**
* Returns a default value for either dark or light modules (return value depends on the output module)
+1 -1
View File
@@ -30,7 +30,7 @@ class QRString extends QROutputAbstract{
/**
* @inheritDoc
*/
protected function getModuleValue($value):string{
protected function prepareModuleValue($value):string{
return $value;
}