codemasher 5 лет назад
Родитель
Сommit
4aec4d2c3c

+ 1 - 1
examples/MyCustomOutput.php

@@ -20,7 +20,7 @@ class MyCustomOutput extends QROutputAbstract{
 		// TODO: Implement setModuleValues() method.
 		// TODO: Implement setModuleValues() method.
 	}
 	}
 
 
-	public function dump(string $file = null){
+	public function dump(string $file = null):string{
 
 
 		$output = '';
 		$output = '';
 
 

+ 5 - 5
examples/QRImageWithLogo.php

@@ -41,9 +41,9 @@ class QRImageWithLogo extends QRImage{
 		}
 		}
 
 
 		$this->matrix->setLogoSpace(
 		$this->matrix->setLogoSpace(
-			$this->options->logoWidth,
-			$this->options->logoHeight
-		// not utilizing the position here
+			$this->options->logoSpaceWidth,
+			$this->options->logoSpaceHeight
+			// not utilizing the position here
 		);
 		);
 
 
 		// there's no need to save the result of dump() into $this->image here
 		// there's no need to save the result of dump() into $this->image here
@@ -56,8 +56,8 @@ class QRImageWithLogo extends QRImage{
 		$h = imagesy($im);
 		$h = imagesy($im);
 
 
 		// set new logo size, leave a border of 1 module
 		// set new logo size, leave a border of 1 module
-		$lw = ($this->options->logoWidth - 2) * $this->options->scale;
-		$lh = ($this->options->logoHeight - 2) * $this->options->scale;
+		$lw = ($this->options->logoSpaceWidth - 2) * $this->options->scale;
+		$lh = ($this->options->logoSpaceHeight - 2) * $this->options->scale;
 
 
 		// get the qrcode size
 		// get the qrcode size
 		$ql = $this->matrix->size() * $this->options->scale;
 		$ql = $this->matrix->size() * $this->options->scale;

+ 3 - 2
examples/custom_output.php

@@ -11,6 +11,7 @@
 namespace chillerlan\QRCodeExamples;
 namespace chillerlan\QRCodeExamples;
 
 
 use chillerlan\QRCode\{QRCode, QROptions};
 use chillerlan\QRCode\{QRCode, QROptions};
+use chillerlan\QRCode\Common\EccLevel;
 
 
 require_once __DIR__.'/../vendor/autoload.php';
 require_once __DIR__.'/../vendor/autoload.php';
 
 
@@ -19,7 +20,7 @@ $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
 // invoke the QROutputInterface manually
 // invoke the QROutputInterface manually
 $options = new QROptions([
 $options = new QROptions([
 	'version'      => 5,
 	'version'      => 5,
-	'eccLevel'     => QRCode::ECC_L,
+	'eccLevel'     => EccLevel::L,
 ]);
 ]);
 
 
 $qrcode = new QRCode($options);
 $qrcode = new QRCode($options);
@@ -33,7 +34,7 @@ var_dump($qrOutputInterface->dump());
 // or just
 // or just
 $options = new QROptions([
 $options = new QROptions([
 	'version'         => 5,
 	'version'         => 5,
-	'eccLevel'        => QRCode::ECC_L,
+	'eccLevel'        => EccLevel::L,
 	'outputType'      => QRCode::OUTPUT_CUSTOM,
 	'outputType'      => QRCode::OUTPUT_CUSTOM,
 	'outputInterface' => MyCustomOutput::class,
 	'outputInterface' => MyCustomOutput::class,
 ]);
 ]);

+ 2 - 1
examples/fpdf.php

@@ -3,6 +3,7 @@
 namespace chillerlan\QRCodeExamples;
 namespace chillerlan\QRCodeExamples;
 
 
 use chillerlan\QRCode\{QRCode, QROptions};
 use chillerlan\QRCode\{QRCode, QROptions};
+use chillerlan\QRCode\Common\EccLevel;
 
 
 require_once __DIR__ . '/../vendor/autoload.php';
 require_once __DIR__ . '/../vendor/autoload.php';
 
 
@@ -11,7 +12,7 @@ $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
 $options = new QROptions([
 $options = new QROptions([
     'version'      => 7,
     'version'      => 7,
     'outputType'   => QRCode::OUTPUT_FPDF,
     'outputType'   => QRCode::OUTPUT_FPDF,
-    'eccLevel'     => QRCode::ECC_L,
+    'eccLevel'     => EccLevel::L,
     'scale'        => 5,
     'scale'        => 5,
     'imageBase64'  => false,
     'imageBase64'  => false,
     'moduleValues' => [
     'moduleValues' => [

+ 4 - 3
examples/html.php

@@ -11,6 +11,7 @@
 namespace chillerlan\QRCodeExamples;
 namespace chillerlan\QRCodeExamples;
 
 
 use chillerlan\QRCode\{QRCode, QROptions};
 use chillerlan\QRCode\{QRCode, QROptions};
+use chillerlan\QRCode\Common\EccLevel;
 
 
 require_once '../vendor/autoload.php';
 require_once '../vendor/autoload.php';
 
 
@@ -60,9 +61,9 @@ header('Content-Type: text/html; charset=utf-8');
 	$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
 	$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
 
 
 	$options = new QROptions([
 	$options = new QROptions([
-		'version' => 5,
-		'outputType' => QRCode::OUTPUT_MARKUP_HTML,
-		'eccLevel' => QRCode::ECC_L,
+		'version'      => 5,
+		'outputType'   => QRCode::OUTPUT_MARKUP_HTML,
+		'eccLevel'     => EccLevel::L,
 		'moduleValues' => [
 		'moduleValues' => [
 			// finder
 			// finder
 			1536 => '#A71111', // dark (true)
 			1536 => '#A71111', // dark (true)

+ 2 - 1
examples/image.php

@@ -11,6 +11,7 @@
 namespace chillerlan\QRCodeExamples;
 namespace chillerlan\QRCodeExamples;
 
 
 use chillerlan\QRCode\{QRCode, QROptions};
 use chillerlan\QRCode\{QRCode, QROptions};
+use chillerlan\QRCode\Common\EccLevel;
 
 
 require_once __DIR__.'/../vendor/autoload.php';
 require_once __DIR__.'/../vendor/autoload.php';
 
 
@@ -19,7 +20,7 @@ $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
 $options = new QROptions([
 $options = new QROptions([
 	'version'      => 10,
 	'version'      => 10,
 	'outputType'   => QRCode::OUTPUT_IMAGE_PNG,
 	'outputType'   => QRCode::OUTPUT_IMAGE_PNG,
-	'eccLevel'     => QRCode::ECC_H,
+	'eccLevel'     => EccLevel::L,
 	'scale'        => 5,
 	'scale'        => 5,
 	'imageBase64'  => false,
 	'imageBase64'  => false,
 	'moduleValues' => [
 	'moduleValues' => [

+ 8 - 7
examples/imageWithLogo.php

@@ -11,28 +11,29 @@
 namespace chillerlan\QRCodeExamples;
 namespace chillerlan\QRCodeExamples;
 
 
 use chillerlan\QRCode\{QRCode, QROptions};
 use chillerlan\QRCode\{QRCode, QROptions};
+use chillerlan\QRCode\Common\EccLevel;
 
 
 require_once __DIR__.'/../vendor/autoload.php';
 require_once __DIR__.'/../vendor/autoload.php';
 
 
 $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
 $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
 /**
 /**
- * @property int $logoWidth
- * @property int $logoHeight
+ * @property int $logoSpaceWidth
+ * @property int $logoSpaceHeight
  *
  *
  * @noinspection PhpIllegalPsrClassPathInspection
  * @noinspection PhpIllegalPsrClassPathInspection
  */
  */
 class LogoOptions extends QROptions{
 class LogoOptions extends QROptions{
-	protected int $logoWidth;
-	protected int $logoHeight;
+	protected int $logoSpaceWidth;
+	protected int $logoSpaceHeight;
 }
 }
 
 
 $options = new LogoOptions;
 $options = new LogoOptions;
 
 
 $options->version          = 7;
 $options->version          = 7;
-$options->eccLevel         = QRCode::ECC_H;
+$options->eccLevel         = EccLevel::H;
 $options->imageBase64      = false;
 $options->imageBase64      = false;
-$options->logoWidth        = 13;
-$options->logoHeight       = 13;
+$options->logoSpaceWidth   = 13;
+$options->logoSpaceHeight  = 13;
 $options->scale            = 5;
 $options->scale            = 5;
 $options->imageTransparent = false;
 $options->imageTransparent = false;
 
 

+ 2 - 1
examples/imagick.php

@@ -11,6 +11,7 @@
 namespace chillerlan\QRCodeExamples;
 namespace chillerlan\QRCodeExamples;
 
 
 use chillerlan\QRCode\{QRCode, QROptions};
 use chillerlan\QRCode\{QRCode, QROptions};
+use chillerlan\QRCode\Common\EccLevel;
 
 
 require_once __DIR__.'/../vendor/autoload.php';
 require_once __DIR__.'/../vendor/autoload.php';
 
 
@@ -19,7 +20,7 @@ $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
 $options = new QROptions([
 $options = new QROptions([
 	'version'      => 7,
 	'version'      => 7,
 	'outputType'   => QRCode::OUTPUT_IMAGICK,
 	'outputType'   => QRCode::OUTPUT_IMAGICK,
-	'eccLevel'     => QRCode::ECC_L,
+	'eccLevel'     => EccLevel::L,
 	'scale'        => 5,
 	'scale'        => 5,
 	'moduleValues' => [
 	'moduleValues' => [
 		// finder
 		// finder

+ 8 - 7
examples/svg.php

@@ -11,6 +11,7 @@
 namespace chillerlan\QRCodeExamples;
 namespace chillerlan\QRCodeExamples;
 
 
 use chillerlan\QRCode\{QRCode, QROptions};
 use chillerlan\QRCode\{QRCode, QROptions};
+use chillerlan\QRCode\Common\EccLevel;
 
 
 require_once __DIR__.'/../vendor/autoload.php';
 require_once __DIR__.'/../vendor/autoload.php';
 
 
@@ -18,14 +19,14 @@ $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
 $gzip = true;
 $gzip = true;
 
 
 $options = new QROptions([
 $options = new QROptions([
-	'version'      => 7,
-	'outputType'   => QRCode::OUTPUT_MARKUP_SVG,
-	'eccLevel'     => QRCode::ECC_L,
+	'version'        => 7,
+	'outputType'     => QRCode::OUTPUT_MARKUP_SVG,
+	'eccLevel'       => EccLevel::L,
 	'svgViewBoxSize' => 530,
 	'svgViewBoxSize' => 530,
-	'addQuietzone' => true,
-	'cssClass'     => 'my-css-class',
-	'svgOpacity'   => 1.0,
-	'svgDefs'      => '
+	'addQuietzone'   => true,
+	'cssClass'       => 'my-css-class',
+	'svgOpacity'     => 1.0,
+	'svgDefs'        => '
 		<linearGradient id="g2">
 		<linearGradient id="g2">
 			<stop offset="0%" stop-color="#39F" />
 			<stop offset="0%" stop-color="#39F" />
 			<stop offset="100%" stop-color="#F3F" />
 			<stop offset="100%" stop-color="#F3F" />

+ 3 - 2
examples/text.php

@@ -11,6 +11,7 @@
 namespace chillerlan\QRCodeExamples;
 namespace chillerlan\QRCodeExamples;
 
 
 use chillerlan\QRCode\{QRCode, QROptions};
 use chillerlan\QRCode\{QRCode, QROptions};
+use chillerlan\QRCode\Common\EccLevel;
 
 
 require_once __DIR__.'/../vendor/autoload.php';
 require_once __DIR__.'/../vendor/autoload.php';
 
 
@@ -19,7 +20,7 @@ $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
 $options = new QROptions([
 $options = new QROptions([
 	'version'      => 5,
 	'version'      => 5,
 	'outputType'   => QRCode::OUTPUT_STRING_TEXT,
 	'outputType'   => QRCode::OUTPUT_STRING_TEXT,
-	'eccLevel'     => QRCode::ECC_L,
+	'eccLevel'     => EccLevel::L,
 ]);
 ]);
 
 
 // <pre> to view it in a browser
 // <pre> to view it in a browser
@@ -30,7 +31,7 @@ echo '<pre style="font-size: 75%; line-height: 1;">'.(new QRCode($options))->ren
 $options = new QROptions([
 $options = new QROptions([
 	'version'      => 5,
 	'version'      => 5,
 	'outputType'   => QRCode::OUTPUT_STRING_TEXT,
 	'outputType'   => QRCode::OUTPUT_STRING_TEXT,
-	'eccLevel'     => QRCode::ECC_L,
+	'eccLevel'     => EccLevel::L,
 	'moduleValues' => [
 	'moduleValues' => [
 		// finder
 		// finder
 		1536 => 'A', // dark (true)
 		1536 => 'A', // dark (true)