Просмотр исходного кода

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

smiley 2 лет назад
Родитель
Сommit
a4ae0e959a

+ 2 - 2
examples/custom_output.php

@@ -31,8 +31,8 @@ class MyCustomOutput extends QROutputAbstract{
 	/**
 	/**
 	 * @inheritDoc
 	 * @inheritDoc
 	 */
 	 */
-	protected function getModuleValue($value){
-		// TODO: Implement getModuleValue() method. (abstract)
+	protected function prepareModuleValue($value){
+		// TODO: Implement prepareModuleValue() method. (abstract)
 		return null;
 		return null;
 	}
 	}
 
 

+ 1 - 1
src/Output/QREps.php

@@ -52,7 +52,7 @@ class QREps extends QROutputAbstract{
 	 *
 	 *
 	 * @inheritDoc
 	 * @inheritDoc
 	 */
 	 */
-	protected function getModuleValue($value):array{
+	protected function prepareModuleValue($value):array{
 		$values = [];
 		$values = [];
 
 
 		foreach(array_values($value) as $i => $val){
 		foreach(array_values($value) as $i => $val){

+ 2 - 2
src/Output/QRFpdf.php

@@ -74,7 +74,7 @@ class QRFpdf extends QROutputAbstract{
 	 *
 	 *
 	 * @inheritDoc
 	 * @inheritDoc
 	 */
 	 */
-	protected function getModuleValue($value):array{
+	protected function prepareModuleValue($value):array{
 		$values = [];
 		$values = [];
 
 
 		foreach(array_values($value) as $i => $val){
 		foreach(array_values($value) as $i => $val){
@@ -107,7 +107,7 @@ class QRFpdf extends QROutputAbstract{
 		$fpdf->AddPage();
 		$fpdf->AddPage();
 
 
 		if($this::moduleValueIsValid($this->options->bgColor)){
 		if($this::moduleValueIsValid($this->options->bgColor)){
-			$bgColor = $this->getModuleValue($this->options->bgColor);
+			$bgColor = $this->prepareModuleValue($this->options->bgColor);
 			/** @phan-suppress-next-line PhanParamTooFewUnpack */
 			/** @phan-suppress-next-line PhanParamTooFewUnpack */
 			$fpdf->SetFillColor(...$bgColor);
 			$fpdf->SetFillColor(...$bgColor);
 			$fpdf->Rect(0, 0, $this->length, $this->length, 'F');
 			$fpdf->Rect(0, 0, $this->length, $this->length, 'F');

+ 5 - 5
src/Output/QRGdImage.php

@@ -110,7 +110,7 @@ class QRGdImage extends QROutputAbstract{
 	 * @inheritDoc
 	 * @inheritDoc
 	 * @throws \chillerlan\QRCode\Output\QRCodeOutputException
 	 * @throws \chillerlan\QRCode\Output\QRCodeOutputException
 	 */
 	 */
-	protected function getModuleValue($value):int{
+	protected function prepareModuleValue($value):int{
 		$values = [];
 		$values = [];
 
 
 		foreach(array_values($value) as $i => $val){
 		foreach(array_values($value) as $i => $val){
@@ -136,7 +136,7 @@ class QRGdImage extends QROutputAbstract{
 	 * @inheritDoc
 	 * @inheritDoc
 	 */
 	 */
 	protected function getDefaultModuleValue(bool $isDark):int{
 	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)){
 		if($this::moduleValueIsValid($this->options->bgColor)){
-			$this->background = $this->getModuleValue($this->options->bgColor);
+			$this->background = $this->prepareModuleValue($this->options->bgColor);
 
 
 			return;
 			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;
 		$transparencyColor = $this->background;
 
 
 		if($this::moduleValueIsValid($this->options->transparencyColor)){
 		if($this::moduleValueIsValid($this->options->transparencyColor)){
-			$transparencyColor = $this->getModuleValue($this->options->transparencyColor);
+			$transparencyColor = $this->prepareModuleValue($this->options->transparencyColor);
 		}
 		}
 
 
 		imagecolortransparent($this->image, $transparencyColor);
 		imagecolortransparent($this->image, $transparencyColor);

+ 5 - 5
src/Output/QRImagick.php

@@ -99,7 +99,7 @@ class QRImagick extends QROutputAbstract{
 	 * @inheritDoc
 	 * @inheritDoc
 	 * @throws \ImagickPixelException
 	 * @throws \ImagickPixelException
 	 */
 	 */
-	protected function getModuleValue($value):ImagickPixel{
+	protected function prepareModuleValue($value):ImagickPixel{
 		return new ImagickPixel($value);
 		return new ImagickPixel($value);
 	}
 	}
 
 
@@ -107,7 +107,7 @@ class QRImagick extends QROutputAbstract{
 	 * @inheritDoc
 	 * @inheritDoc
 	 */
 	 */
 	protected function getDefaultModuleValue(bool $isDark):ImagickPixel{
 	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)){
 		if($this::moduleValueIsValid($this->options->bgColor)){
-			$this->background = $this->getModuleValue($this->options->bgColor);
+			$this->background = $this->prepareModuleValue($this->options->bgColor);
 
 
 			return;
 			return;
 		}
 		}
 
 
-		$this->background = $this->getModuleValue('white');
+		$this->background = $this->prepareModuleValue('white');
 	}
 	}
 
 
 	/**
 	/**
@@ -173,7 +173,7 @@ class QRImagick extends QROutputAbstract{
 		$transparencyColor = $this->background;
 		$transparencyColor = $this->background;
 
 
 		if($this::moduleValueIsValid($this->options->transparencyColor)){
 		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);
 		$this->imagick->transparentPaintImage($transparencyColor, 0.0, 10, false);

+ 1 - 1
src/Output/QRMarkup.php

@@ -57,7 +57,7 @@ abstract class QRMarkup extends QROutputAbstract{
 	/**
 	/**
 	 * @inheritDoc
 	 * @inheritDoc
 	 */
 	 */
-	protected function getModuleValue($value):string{
+	protected function prepareModuleValue($value):string{
 		return trim(strip_tags($value), " '\"\r\n\t");
 		return trim(strip_tags($value), " '\"\r\n\t");
 	}
 	}
 
 

+ 2 - 2
src/Output/QROutputAbstract.php

@@ -85,7 +85,7 @@ abstract class QROutputAbstract implements QROutputInterface{
 			$value = ($this->options->moduleValues[$M_TYPE] ?? null);
 			$value = ($this->options->moduleValues[$M_TYPE] ?? null);
 
 
 			$this->moduleValues[$M_TYPE] = $this::moduleValueIsValid($value)
 			$this->moduleValues[$M_TYPE] = $this::moduleValueIsValid($value)
-				? $this->getModuleValue($value)
+				? $this->prepareModuleValue($value)
 				: $this->getDefaultModuleValue($defaultValue);
 				: $this->getDefaultModuleValue($defaultValue);
 		}
 		}
 
 
@@ -98,7 +98,7 @@ abstract class QROutputAbstract implements QROutputInterface{
 	 *
 	 *
 	 * @return mixed
 	 * @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)
 	 * Returns a default value for either dark or light modules (return value depends on the output module)

+ 1 - 1
src/Output/QRString.php

@@ -30,7 +30,7 @@ class QRString extends QROutputAbstract{
 	/**
 	/**
 	 * @inheritDoc
 	 * @inheritDoc
 	 */
 	 */
-	protected function getModuleValue($value):string{
+	protected function prepareModuleValue($value):string{
 		return $value;
 		return $value;
 	}
 	}