Przeglądaj źródła

:octocat: rename QROutputAbstract::base64encode() to toBase64DataURI() to better reflect what it does

smiley 3 lat temu
rodzic
commit
20de869bb9

+ 1 - 1
examples/imageWithLogo.php

@@ -64,7 +64,7 @@ class QRImageWithLogo extends QRGdImage{
 		}
 
 		if($this->options->imageBase64){
-			$imageData = $this->base64encode($imageData, 'image/'.$this->options->outputType);
+			$imageData = $this->toBase64DataURI($imageData, 'image/'.$this->options->outputType);
 		}
 
 		return $imageData;

+ 1 - 1
examples/imageWithText.php

@@ -44,7 +44,7 @@ class QRImageWithText extends QRGdImage{
 		}
 
 		if($this->options->imageBase64){
-			$imageData = $this->base64encode($imageData, 'image/'.$this->options->outputType);
+			$imageData = $this->toBase64DataURI($imageData, 'image/'.$this->options->outputType);
 		}
 
 		return $imageData;

+ 1 - 1
examples/svgRoundQuietzone.php

@@ -57,7 +57,7 @@ class RoundQuietzoneSVGoutput extends QRMarkupSVG{
 
 		// transform to data URI only when not saving to file
 		if(!$saveToFile && $this->options->imageBase64){
-			$svg = $this->base64encode($svg, 'image/svg+xml');
+			$svg = $this->toBase64DataURI($svg, 'image/svg+xml');
 		}
 
 		return $svg;

+ 1 - 1
src/Output/QRFpdf.php

@@ -106,7 +106,7 @@ class QRFpdf extends QROutputAbstract{
 		}
 
 		if($this->options->imageBase64){
-			$pdfData = $this->base64encode($pdfData, 'application/pdf');
+			$pdfData = $this->toBase64DataURI($pdfData, 'application/pdf');
 		}
 
 		return $pdfData;

+ 1 - 1
src/Output/QRGdImage.php

@@ -131,7 +131,7 @@ class QRGdImage extends QROutputAbstract{
 		}
 
 		if($this->options->imageBase64){
-			$imageData = $this->base64encode($imageData, 'image/'.$this->options->outputType);
+			$imageData = $this->toBase64DataURI($imageData, 'image/'.$this->options->outputType);
 		}
 
 		restore_error_handler();

+ 1 - 1
src/Output/QRMarkupSVG.php

@@ -40,7 +40,7 @@ class QRMarkupSVG extends QRMarkup{
 
 		// transform to data URI only when not saving to file
 		if(!$saveToFile && $this->options->imageBase64){
-			$svg = $this->base64encode($svg, 'image/svg+xml');
+			$svg = $this->toBase64DataURI($svg, 'image/svg+xml');
 		}
 
 		return $svg;

+ 1 - 1
src/Output/QROutputAbstract.php

@@ -117,7 +117,7 @@ abstract class QROutputAbstract implements QROutputInterface{
 	/**
 	 * Returns a base64 data URI for the given string and mime type
 	 */
-	protected function base64encode(string $data, string $mime):string{
+	protected function toBase64DataURI(string $data, string $mime):string{
 		return sprintf('data:%s;base64,%s', $mime, base64_encode($data));
 	}