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

:shower: extract OUTPUT_* constants from QRCode to QROutputInterface and mark QRCode::OUTPUT_* as deprecated

smiley 3 лет назад
Родитель
Сommit
ae1c1f56ca

+ 2 - 2
examples/custom_output.php

@@ -10,7 +10,7 @@
 
 use chillerlan\QRCode\{QRCode, QROptions};
 use chillerlan\QRCode\Common\EccLevel;
-use chillerlan\QRCode\Output\QROutputAbstract;
+use chillerlan\QRCode\Output\{QROutputAbstract, QROutputInterface};
 
 require_once __DIR__.'/../vendor/autoload.php';
 
@@ -88,7 +88,7 @@ var_dump($qrOutputInterface->dump());
 $options = new QROptions([
 	'version'         => 5,
 	'eccLevel'        => EccLevel::L,
-	'outputType'      => QRCode::OUTPUT_CUSTOM,
+	'outputType'      => QROutputInterface::CUSTOM,
 	'outputInterface' => MyCustomOutput::class,
 ]);
 

+ 2 - 1
examples/eps.php

@@ -9,12 +9,13 @@
 use chillerlan\QRCode\{QRCode, QROptions};
 use chillerlan\QRCode\Common\EccLevel;
 use chillerlan\QRCode\Data\QRMatrix;
+use chillerlan\QRCode\Output\QROutputInterface;
 
 require_once __DIR__.'/../vendor/autoload.php';
 
 $options = new QROptions([
 	'version'      => 7,
-	'outputType'   => QRCode::OUTPUT_EPS,
+	'outputType'   => QROutputInterface::EPS,
 	'eccLevel'     => EccLevel::L,
 	'scale'        => 5,
 	'addQuietzone' => true,

+ 3 - 2
examples/fpdf.php

@@ -6,14 +6,15 @@
  */
 
 use chillerlan\QRCode\{QRCode, QROptions};
-use chillerlan\QRCode\Data\QRMatrix;
 use chillerlan\QRCode\Common\EccLevel;
+use chillerlan\QRCode\Data\QRMatrix;
+use chillerlan\QRCode\Output\QROutputInterface;
 
 require_once __DIR__ . '/../vendor/autoload.php';
 
 $options = new QROptions([
     'version'      => 7,
-    'outputType'   => QRCode::OUTPUT_FPDF,
+    'outputType'   => QROutputInterface::FPDF,
     'eccLevel'     => EccLevel::L,
     'scale'        => 5,
     'imageBase64'  => false,

+ 3 - 2
examples/html.php

@@ -7,8 +7,9 @@
  */
 
 use chillerlan\QRCode\{QRCode, QROptions};
-use chillerlan\QRCode\Data\QRMatrix;
 use chillerlan\QRCode\Common\EccLevel;
+use chillerlan\QRCode\Data\QRMatrix;
+use chillerlan\QRCode\Output\QROutputInterface;
 
 require_once '../vendor/autoload.php';
 
@@ -16,7 +17,7 @@ header('Content-Type: text/html; charset=utf-8');
 
 	$options = new QROptions([
 		'version'      => 5,
-		'outputType'   => QRCode::OUTPUT_MARKUP_HTML,
+		'outputType'   => QROutputInterface::MARKUP_HTML,
 		'eccLevel'     => EccLevel::L,
 		'cssClass'     => 'qrcode',
 		'moduleValues' => [

+ 3 - 2
examples/image.php

@@ -7,14 +7,15 @@
  */
 
 use chillerlan\QRCode\{QRCode, QROptions};
-use chillerlan\QRCode\Data\QRMatrix;
 use chillerlan\QRCode\Common\EccLevel;
+use chillerlan\QRCode\Data\QRMatrix;
+use chillerlan\QRCode\Output\QROutputInterface;
 
 require_once __DIR__.'/../vendor/autoload.php';
 
 $options = new QROptions([
 	'version'             => 7,
-	'outputType'          => QRCode::OUTPUT_IMAGE_PNG,
+	'outputType'          => QROutputInterface::GDIMAGE_PNG,
 	'eccLevel'            => EccLevel::L,
 	'scale'               => 10,
 	'imageBase64'         => false,

+ 3 - 3
examples/imageWithText.php

@@ -12,7 +12,7 @@
  */
 
 use chillerlan\QRCode\{QRCode, QROptions};
-use chillerlan\QRCode\Output\QRGdImage;
+use chillerlan\QRCode\Output\{QROutputInterface, QRGdImage};
 
 require_once __DIR__.'/../vendor/autoload.php';
 
@@ -70,7 +70,7 @@ class QRImageWithText extends QRGdImage{
 		$background  = imagecolorallocate($this->image, ...$textBG);
 
 		// allow transparency
-		if($this->options->imageTransparent && $this->options->outputType !== QRCode::OUTPUT_IMAGE_JPG){
+		if($this->options->imageTransparent && $this->options->outputType !== QROutputInterface::GDIMAGE_JPG){
 			imagecolortransparent($this->image, $background);
 		}
 
@@ -100,7 +100,7 @@ class QRImageWithText extends QRGdImage{
 
 $options = new QROptions([
 	'version'      => 7,
-	'outputType'   => QRCode::OUTPUT_IMAGE_PNG,
+	'outputType'   => QROutputInterface::GDIMAGE_PNG,
 	'scale'        => 3,
 	'imageBase64'  => false,
 ]);

+ 3 - 2
examples/imagick.php

@@ -7,14 +7,15 @@
  */
 
 use chillerlan\QRCode\{QRCode, QROptions};
-use chillerlan\QRCode\Data\QRMatrix;
 use chillerlan\QRCode\Common\EccLevel;
+use chillerlan\QRCode\Data\QRMatrix;
+use chillerlan\QRCode\Output\QROutputInterface;
 
 require_once __DIR__.'/../vendor/autoload.php';
 
 $options = new QROptions([
 	'version'             => 7,
-	'outputType'          => QRCode::OUTPUT_IMAGICK,
+	'outputType'          => QROutputInterface::IMAGICK,
 	'eccLevel'            => EccLevel::L,
 	'imagickBG'           => '#FFFFFF',
 	'scale'               => 20,

+ 3 - 2
examples/svg.php

@@ -10,14 +10,15 @@
  */
 
 use chillerlan\QRCode\{QRCode, QROptions};
-use chillerlan\QRCode\Data\QRMatrix;
 use chillerlan\QRCode\Common\EccLevel;
+use chillerlan\QRCode\Data\QRMatrix;
+use chillerlan\QRCode\Output\QROutputInterface;
 
 require_once __DIR__.'/../vendor/autoload.php';
 
 $options = new QROptions([
 	'version'             => 7,
-	'outputType'          => QRCode::OUTPUT_MARKUP_SVG,
+	'outputType'          => QROutputInterface::MARKUP_SVG,
 	'imageBase64'         => false,
 	'eccLevel'            => EccLevel::L,
 	'addQuietzone'        => true,

+ 2 - 2
examples/svgMeltedModules.php

@@ -9,7 +9,7 @@
 
 use chillerlan\QRCode\Common\EccLevel;
 use chillerlan\QRCode\Data\QRMatrix;
-use chillerlan\QRCode\Output\QRMarkupSVG;
+use chillerlan\QRCode\Output\{QROutputInterface, QRMarkupSVG};
 use chillerlan\QRCode\{QRCode, QROptions};
 
 require_once __DIR__.'/../vendor/autoload.php';
@@ -249,7 +249,7 @@ $options = new MeltedOutputOptions([
 	'connectPaths'    => true,
 	'imageBase64'     => false,
 
-	'outputType'      => QRCode::OUTPUT_CUSTOM,
+	'outputType'      => QROutputInterface::CUSTOM,
 	'outputInterface' => MeltedSVGQRCodeOutput::class,
 	'excludeFromConnect'        => [
 		QRMatrix::M_FINDER|QRMatrix::IS_DARK,

+ 2 - 2
examples/svgRandomColoredDots.php

@@ -12,7 +12,7 @@
 
 use chillerlan\QRCode\Common\EccLevel;
 use chillerlan\QRCode\Data\QRMatrix;
-use chillerlan\QRCode\Output\QRMarkupSVG;
+use chillerlan\QRCode\Output\{QROutputInterface, QRMarkupSVG};
 use chillerlan\QRCode\{QRCode, QROptions};
 
 require_once __DIR__.'/../vendor/autoload.php';
@@ -120,7 +120,7 @@ $options = new RandomDotsOptions([
 	'eccLevel'            => EccLevel::H,
 	'addQuietzone'        => true,
 	'imageBase64'         => false,
-	'outputType'          => QRCode::OUTPUT_CUSTOM,
+	'outputType'          => QROutputInterface::CUSTOM,
 	'outputInterface'     => RandomDotsSVGOutput::class,
 	'markupDark'          => '',
 	'markupLight'         => '',

+ 2 - 2
examples/svgRoundQuietzone.php

@@ -12,7 +12,7 @@
 
 use chillerlan\QRCode\Common\EccLevel;
 use chillerlan\QRCode\Data\QRMatrix;
-use chillerlan\QRCode\Output\QRMarkupSVG;
+use chillerlan\QRCode\Output\{QROutputInterface, QRMarkupSVG};
 use chillerlan\QRCode\{QRCode, QROptions};
 
 require_once __DIR__.'/../vendor/autoload.php';
@@ -170,7 +170,7 @@ $options = new RoundQuietzoneOptions([
 	'eccLevel'            => EccLevel::H, // maximum error correction capacity, esp. for print
 	'addQuietzone'        => false, // we're not adding a quiet zone, this is done internally in our own module
 	'imageBase64'         => false, // avoid base64 URI output
-	'outputType'          => QRCode::OUTPUT_CUSTOM,
+	'outputType'          => QROutputInterface::CUSTOM,
 	'outputInterface'     => RoundQuietzoneSVGoutput::class, // load our own output class
 	'markupDark'          => '', // avoid "fill" attributes on paths
 	'markupLight'         => '',

+ 2 - 2
examples/svgWithLogo.php

@@ -11,7 +11,7 @@
 use chillerlan\QRCode\{QRCode, QRCodeException, QROptions};
 use chillerlan\QRCode\Common\EccLevel;
 use chillerlan\QRCode\Data\QRMatrix;
-use chillerlan\QRCode\Output\QRMarkupSVG;
+use chillerlan\QRCode\Output\{QROutputInterface, QRMarkupSVG};
 
 require_once __DIR__.'/../vendor/autoload.php';
 
@@ -102,7 +102,7 @@ $options = new SVGWithLogoOptions([
 	'svgLogoCssClass'     => 'dark',
 	// QROptions
 	'version'             => 5,
-	'outputType'          => QRCode::OUTPUT_CUSTOM,
+	'outputType'          => QROutputInterface::CUSTOM,
 	'outputInterface'     => QRSvgWithLogo::class,
 	'imageBase64'         => false,
 	// ECC level H is necessary when using logos

+ 3 - 2
examples/text.php

@@ -9,15 +9,16 @@
  */
 
 use chillerlan\QRCode\{QRCode, QROptions};
-use chillerlan\QRCode\Data\QRMatrix;
 use chillerlan\QRCode\Common\EccLevel;
+use chillerlan\QRCode\Data\QRMatrix;
+use chillerlan\QRCode\Output\QROutputInterface;
 use PHPUnit\Util\Color;
 
 require_once __DIR__.'/../vendor/autoload.php';
 
 $options = new QROptions([
 	'version'      => 7,
-	'outputType'   => QRCode::OUTPUT_STRING_TEXT,
+	'outputType'   => QROutputInterface::STRING_TEXT,
 	'eccLevel'     => EccLevel::L,
 	'eol'          => Color::colorize('reset', "\x00\n"),
 	'moduleValues' => [

+ 4 - 5
src/Output/QRGdImage.php

@@ -13,7 +13,6 @@
 namespace chillerlan\QRCode\Output;
 
 use chillerlan\QRCode\Data\QRMatrix;
-use chillerlan\QRCode\QRCode;
 use chillerlan\Settings\SettingsContainerInterface;
 use ErrorException, Throwable;
 use function array_values, count, extension_loaded, imagecolorallocate, imagecolortransparent, imagecreatetruecolor,
@@ -102,7 +101,7 @@ class QRGdImage extends QROutputAbstract{
 		/** @phan-suppress-next-line PhanParamTooFewInternalUnpack */
 		$background = imagecolorallocate($this->image, ...$tbg);
 
-		if($this->options->imageTransparent && $this->options->outputType !== QRCode::OUTPUT_IMAGE_JPG){
+		if($this->options->imageTransparent && $this->options->outputType !== QROutputInterface::GDIMAGE_JPG){
 			imagecolortransparent($this->image, $background);
 		}
 
@@ -177,14 +176,14 @@ class QRGdImage extends QROutputAbstract{
 		try{
 
 			switch($this->options->outputType){
-				case QRCode::OUTPUT_IMAGE_GIF:
+				case QROutputInterface::GDIMAGE_GIF:
 					imagegif($this->image);
 					break;
-				case QRCode::OUTPUT_IMAGE_JPG:
+				case QROutputInterface::GDIMAGE_JPG:
 					imagejpeg($this->image, null, max(0, min(100, $this->options->jpegQuality)));
 					break;
 				// silently default to png output
-				case QRCode::OUTPUT_IMAGE_PNG:
+				case QROutputInterface::GDIMAGE_PNG:
 				default:
 					imagepng($this->image, null, max(-1, min(9, $this->options->pngCompression)));
 			}

+ 44 - 0
src/Output/QROutputInterface.php

@@ -17,6 +17,50 @@ use chillerlan\QRCode\Data\QRMatrix;
  */
 interface QROutputInterface{
 
+	/** @var string */
+	const MARKUP_HTML = 'html';
+	/** @var string */
+	const MARKUP_SVG  = 'svg';
+	/** @var string */
+	const GDIMAGE_PNG = 'png';
+	/** @var string */
+	const GDIMAGE_JPG = 'jpg';
+	/** @var string */
+	const GDIMAGE_GIF = 'gif';
+	/** @var string */
+	const STRING_JSON = 'json';
+	/** @var string */
+	const STRING_TEXT = 'text';
+	/** @var string */
+	const IMAGICK     = 'imagick';
+	/** @var string */
+	const FPDF        = 'fpdf';
+	/** @var string */
+	const EPS         = 'eps';
+	/** @var string */
+	const CUSTOM      = 'custom';
+
+	/**
+	 * Map of built-in output modes => modules
+	 *
+	 * @var string[]
+	 */
+	const MODES = [
+		self::MARKUP_SVG  => QRMarkupSVG::class,
+		self::MARKUP_HTML => QRMarkupHTML::class,
+		self::GDIMAGE_PNG => QRGdImage::class,
+		self::GDIMAGE_GIF => QRGdImage::class,
+		self::GDIMAGE_JPG => QRGdImage::class,
+		self::STRING_JSON => QRString::class,
+		self::STRING_TEXT => QRString::class,
+		self::IMAGICK     => QRImagick::class,
+		self::FPDF        => QRFpdf::class,
+		self::EPS         => QREps::class,
+	];
+
+	/**
+	 * @var bool[]
+	 */
 	const DEFAULT_MODULE_VALUES = [
 		// light
 		QRMatrix::M_NULL                           => false,

+ 2 - 4
src/Output/QRString.php

@@ -13,8 +13,6 @@
 
 namespace chillerlan\QRCode\Output;
 
-use chillerlan\QRCode\QRCode;
-
 use function implode, is_string, json_encode;
 
 /**
@@ -50,10 +48,10 @@ class QRString extends QROutputAbstract{
 		$file ??= $this->options->cachefile;
 
 		switch($this->options->outputType){
-			case QRCode::OUTPUT_STRING_TEXT:
+			case QROutputInterface::STRING_TEXT:
 				$data = $this->text();
 				break;
-			case QRCode::OUTPUT_STRING_JSON:
+			case QROutputInterface::STRING_JSON:
 			default:
 				$data = $this->json();
 		}

+ 84 - 43
src/QRCode.php

@@ -13,9 +13,7 @@ namespace chillerlan\QRCode;
 use chillerlan\QRCode\Common\{EccLevel, ECICharset, MaskPattern, Mode, Version};
 use chillerlan\QRCode\Data\{AlphaNum, Byte, ECI, Kanji, Number, QRCodeDataException, QRData, QRDataModeInterface, QRMatrix};
 use chillerlan\QRCode\Decoder\{Decoder, DecoderResult, LuminanceSourceInterface};
-use chillerlan\QRCode\Output\{
-	QRCodeOutputException, QRFpdf, QRGdImage, QRImagick, QRMarkupHTML, QRMarkupSVG, QREps, QROutputInterface, QRString
-};
+use chillerlan\QRCode\Output\{QRCodeOutputException, QROutputInterface};
 use chillerlan\Settings\SettingsContainerInterface;
 use function class_exists, class_implements, in_array, mb_convert_encoding, mb_detect_encoding;
 
@@ -72,46 +70,89 @@ class QRCode{
 	 */
 	public const ECC_H = EccLevel::H;
 
-	/** @var string */
-	public const OUTPUT_MARKUP_HTML = 'html';
-	/** @var string */
-	public const OUTPUT_MARKUP_SVG  = 'svg';
-	/** @var string */
-	public const OUTPUT_IMAGE_PNG   = 'png';
-	/** @var string */
-	public const OUTPUT_IMAGE_JPG   = 'jpg';
-	/** @var string */
-	public const OUTPUT_IMAGE_GIF   = 'gif';
-	/** @var string */
-	public const OUTPUT_STRING_JSON = 'json';
-	/** @var string */
-	public const OUTPUT_STRING_TEXT = 'text';
-	/** @var string */
-	public const OUTPUT_IMAGICK     = 'imagick';
-	/** @var string */
-	public const OUTPUT_FPDF        = 'fpdf';
-	/** @var string */
-	public const OUTPUT_EPS         = 'eps';
-	/** @var string */
-	public const OUTPUT_CUSTOM      = 'custom';
-
-	/**
-	 * Map of built-in output modes => modules
-	 *
+	/**
+	 * @deprecated 5.0.0 use QROutputInterface::MARKUP_HTML instead
+	 * @see \chillerlan\QRCode\Output\QROutputInterface::MARKUP_HTML
+	 * @var string
+	 */
+	public const OUTPUT_MARKUP_HTML = QROutputInterface::MARKUP_HTML;
+
+	/**
+	 * @deprecated 5.0.0 use QROutputInterface::MARKUP_SVG instead
+	 * @see \chillerlan\QRCode\Output\QROutputInterface::MARKUP_SVG
+	 * @var string
+	 */
+	public const OUTPUT_MARKUP_SVG  = QROutputInterface::MARKUP_SVG;
+
+	/**
+	 * @deprecated 5.0.0 use QROutputInterface::GDIMAGE_PNG instead
+	 * @see \chillerlan\QRCode\Output\QROutputInterface::GDIMAGE_PNG
+	 * @var string
+	 */
+	public const OUTPUT_IMAGE_PNG   = QROutputInterface::GDIMAGE_PNG;
+
+	/**
+	 * @deprecated 5.0.0 use QROutputInterface::GDIMAGE_JPG instead
+	 * @see \chillerlan\QRCode\Output\QROutputInterface::GDIMAGE_JPG
+	 * @var string
+	 */
+	public const OUTPUT_IMAGE_JPG   = QROutputInterface::GDIMAGE_JPG;
+
+	/**
+	 * @deprecated 5.0.0 use QROutputInterface::GDIMAGE_GIF instead
+	 * @see \chillerlan\QRCode\Output\QROutputInterface::GDIMAGE_GIF
+	 * @var string
+	 */
+	public const OUTPUT_IMAGE_GIF   = QROutputInterface::GDIMAGE_GIF;
+
+	/**
+	 * @deprecated 5.0.0 use QROutputInterface::STRING_JSON instead
+	 * @see \chillerlan\QRCode\Output\QROutputInterface::STRING_JSON
+	 * @var string
+	 */
+	public const OUTPUT_STRING_JSON = QROutputInterface::STRING_JSON;
+
+	/**
+	 * @deprecated 5.0.0 use QROutputInterface::STRING_TEXT instead
+	 * @see \chillerlan\QRCode\Output\QROutputInterface::STRING_TEXT
+	 * @var string
+	 */
+	public const OUTPUT_STRING_TEXT = QROutputInterface::STRING_TEXT;
+
+	/**
+	 * @deprecated 5.0.0 use QROutputInterface::IMAGICK instead
+	 * @see \chillerlan\QRCode\Output\QROutputInterface::IMAGICK
+	 * @var string
+	 */
+	public const OUTPUT_IMAGICK     = QROutputInterface::IMAGICK;
+
+	/**
+	 * @deprecated 5.0.0 use QROutputInterface::FPDF instead
+	 * @see \chillerlan\QRCode\Output\QROutputInterface::FPDF
+	 * @var string
+	 */
+	public const OUTPUT_FPDF        = QROutputInterface::FPDF;
+
+	/**
+	 * @deprecated 5.0.0 use QROutputInterface::EPS instead
+	 * @see \chillerlan\QRCode\Output\QROutputInterface::EPS
+	 * @var string
+	 */
+	public const OUTPUT_EPS         = QROutputInterface::EPS;
+
+	/**
+	 * @deprecated 5.0.0 use QROutputInterface::CUSTOM instead
+	 * @see \chillerlan\QRCode\Output\QROutputInterface::CUSTOM
+	 * @var string
+	 */
+	public const OUTPUT_CUSTOM      = QROutputInterface::CUSTOM;
+
+	/**
+	 * @deprecated 5.0.0 use QROutputInterface::MODES instead
+	 * @see \chillerlan\QRCode\Output\QROutputInterface::MODES
 	 * @var string[]
 	 */
-	public const OUTPUT_MODES = [
-		self::OUTPUT_MARKUP_SVG  => QRMarkupSVG::class,
-		self::OUTPUT_MARKUP_HTML => QRMarkupHTML::class,
-		self::OUTPUT_IMAGE_PNG   => QRGdImage::class,
-		self::OUTPUT_IMAGE_GIF   => QRGdImage::class,
-		self::OUTPUT_IMAGE_JPG   => QRGdImage::class,
-		self::OUTPUT_STRING_JSON => QRString::class,
-		self::OUTPUT_STRING_TEXT => QRString::class,
-		self::OUTPUT_IMAGICK     => QRImagick::class,
-		self::OUTPUT_FPDF        => QRFpdf::class,
-		self::OUTPUT_EPS         => QREps::class,
-	];
+	public const OUTPUT_MODES       = QROutputInterface::MODES;
 
 	/**
 	 * The settings container
@@ -202,11 +243,11 @@ class QRCode{
 	 */
 	protected function initOutputInterface():QROutputInterface{
 
-		if($this->options->outputType === $this::OUTPUT_CUSTOM){
+		if($this->options->outputType === QROutputInterface::CUSTOM){
 			return $this->initCustomOutputInterface();
 		}
 
-		$outputInterface = $this::OUTPUT_MODES[$this->options->outputType] ?? false;
+		$outputInterface = QROutputInterface::MODES[$this->options->outputType] ?? false;
 
 		if($outputInterface){
 			return new $outputInterface($this->options, $this->getMatrix());

+ 9 - 5
src/QROptionsTrait.php

@@ -12,6 +12,7 @@
 
 namespace chillerlan\QRCode;
 
+use chillerlan\QRCode\Output\QROutputInterface;
 use chillerlan\QRCode\Common\{EccLevel, MaskPattern, Version};
 use chillerlan\QRCode\Decoder\{GDLuminanceSource, IMagickLuminanceSource};
 use function array_values, count, extension_loaded, in_array, is_numeric, max, min, sprintf, strtolower;
@@ -76,12 +77,15 @@ trait QROptionsTrait{
 	/**
 	 * The output type
 	 *
-	 *   - QRCode::OUTPUT_MARKUP_XXXX where XXXX = HTML, SVG
-	 *   - QRCode::OUTPUT_IMAGE_XXX where XXX = PNG, GIF, JPG
-	 *   - QRCode::OUTPUT_STRING_XXXX where XXXX = TEXT, JSON
-	 *   - QRCode::OUTPUT_CUSTOM
+	 *   - QROutputInterface::MARKUP_XXXX where XXXX = HTML, SVG
+	 *   - QROutputInterface::GDIMAGE_XXX where XXX = PNG, GIF, JPG
+	 *   - QROutputInterface::STRING_XXXX where XXXX = TEXT, JSON
+	 *   - QROutputInterface::IMAGICK
+	 *   - QROutputInterface::EPS
+	 *   - QROutputInterface::FPDF
+	 *   - QROutputInterface::CUSTOM
 	 */
-	protected string $outputType = QRCode::OUTPUT_MARKUP_SVG;
+	protected string $outputType = QROutputInterface::MARKUP_SVG;
 
 	/**
 	 * the FQCN of the custom QROutputInterface if $outputType is set to QRCode::OUTPUT_CUSTOM

+ 2 - 2
tests/Data/QRMatrixTest.php

@@ -13,7 +13,7 @@ namespace chillerlan\QRCodeTest\Data;
 use chillerlan\QRCode\{QRCode, QROptions};
 use chillerlan\QRCode\Common\{EccLevel, MaskPattern, Version};
 use chillerlan\QRCode\Data\{QRCodeDataException, QRMatrix};
-use chillerlan\QRCode\Output\QRString;
+use chillerlan\QRCode\Output\{QROutputInterface, QRString};
 use PHPUnit\Framework\TestCase;
 use PHPUnit\Util\Color;
 use Generator;
@@ -42,7 +42,7 @@ final class QRMatrixTest extends TestCase{
 	 */
 	public static function debugMatrix(QRMatrix $matrix):void{
 		$opt = new QROptions;
-		$opt->outputType  = QRCode::OUTPUT_STRING_TEXT;
+		$opt->outputType  = QROutputInterface::STRING_TEXT;
 		$opt->eol         = Color::colorize('reset', "\x00\n");
 		$opt->moduleValues = [
 			// finder

+ 2 - 3
tests/Output/QRFpdfTest.php

@@ -11,9 +11,8 @@
 namespace chillerlan\QRCodeTest\Output;
 
 use FPDF;
-use chillerlan\QRCode\QRCode;
 use chillerlan\QRCode\Data\QRMatrix;
-use chillerlan\QRCode\Output\QRFpdf;
+use chillerlan\QRCode\Output\{QRFpdf, QROutputInterface};
 
 use function class_exists;
 
@@ -23,7 +22,7 @@ use function class_exists;
 final class QRFpdfTest extends QROutputTestAbstract{
 
 	protected string $FQN  = QRFpdf::class;
-	protected string $type = QRCode::OUTPUT_FPDF;
+	protected string $type = QROutputInterface::FPDF;
 
 	/**
 	 * @inheritDoc

+ 2 - 2
tests/Output/QRGdImageGIFTest.php

@@ -10,13 +10,13 @@
 
 namespace chillerlan\QRCodeTest\Output;
 
-use chillerlan\QRCode\QRCode;
+use chillerlan\QRCode\Output\QROutputInterface;
 
 /**
  *
  */
 final class QRGdImageGIFTest extends QRGdImageTestAbstract{
 
-	protected string $type = QRCode::OUTPUT_IMAGE_GIF;
+	protected string $type = QROutputInterface::GDIMAGE_GIF;
 
 }

+ 2 - 2
tests/Output/QRGdImageJPGTest.php

@@ -10,13 +10,13 @@
 
 namespace chillerlan\QRCodeTest\Output;
 
-use chillerlan\QRCode\QRCode;
+use chillerlan\QRCode\Output\QROutputInterface;
 
 /**
  *
  */
 final class QRGdImageJPGTest extends QRGdImageTestAbstract{
 
-	protected string $type = QRCode::OUTPUT_IMAGE_JPG;
+	protected string $type = QROutputInterface::GDIMAGE_JPG;
 
 }

+ 2 - 2
tests/Output/QRGdImagePNGTest.php

@@ -10,13 +10,13 @@
 
 namespace chillerlan\QRCodeTest\Output;
 
-use chillerlan\QRCode\QRCode;
+use chillerlan\QRCode\Output\QROutputInterface;
 
 /**
  *
  */
 final class QRGdImagePNGTest extends QRGdImageTestAbstract{
 
-	protected string $type = QRCode::OUTPUT_IMAGE_PNG;
+	protected string $type = QROutputInterface::GDIMAGE_PNG;
 
 }

+ 2 - 3
tests/Output/QRImagickTest.php

@@ -13,9 +13,8 @@
 
 namespace chillerlan\QRCodeTest\Output;
 
-use chillerlan\QRCode\QRCode;
 use chillerlan\QRCode\Data\QRMatrix;
-use chillerlan\QRCode\Output\QRImagick;
+use chillerlan\QRCode\Output\{QRImagick, QROutputInterface};
 use Imagick;
 
 /**
@@ -24,7 +23,7 @@ use Imagick;
 final class QRImagickTest extends QROutputTestAbstract{
 
 	protected string $FQN  = QRImagick::class;
-	protected string $type = QRCode::OUTPUT_IMAGICK;
+	protected string $type = QROutputInterface::IMAGICK;
 
 	/**
 	 * @inheritDoc

+ 2 - 3
tests/Output/QRMarkupHTMLTest.php

@@ -10,8 +10,7 @@
 
 namespace chillerlan\QRCodeTest\Output;
 
-use chillerlan\QRCode\Output\QRMarkupHTML;
-use chillerlan\QRCode\QRCode;
+use chillerlan\QRCode\Output\{QRMarkupHTML, QROutputInterface};
 
 /**
  *
@@ -19,6 +18,6 @@ use chillerlan\QRCode\QRCode;
 final class QRMarkupHTMLTest extends QRMarkupTestAbstract{
 
 	protected string $FQN  = QRMarkupHTML::class;
-	protected string $type = QRCode::OUTPUT_MARKUP_HTML;
+	protected string $type = QROutputInterface::MARKUP_HTML;
 
 }

+ 2 - 3
tests/Output/QRMarkupSVGTest.php

@@ -10,8 +10,7 @@
 
 namespace chillerlan\QRCodeTest\Output;
 
-use chillerlan\QRCode\Output\QRMarkupSVG;
-use chillerlan\QRCode\QRCode;
+use chillerlan\QRCode\Output\{QRMarkupSVG, QROutputInterface};
 
 /**
  *
@@ -19,6 +18,6 @@ use chillerlan\QRCode\QRCode;
 final class QRMarkupSVGTest extends QRMarkupTestAbstract{
 
 	protected string $FQN  = QRMarkupSVG::class;
-	protected string $type = QRCode::OUTPUT_MARKUP_SVG;
+	protected string $type = QROutputInterface::MARKUP_SVG;
 
 }

+ 2 - 2
tests/Output/QRStringJSONTest.php

@@ -10,7 +10,7 @@
 
 namespace chillerlan\QRCodeTest\Output;
 
-use chillerlan\QRCode\QRCode;
+use chillerlan\QRCode\Output\QROutputInterface;
 use function extension_loaded;
 
 /**
@@ -18,7 +18,7 @@ use function extension_loaded;
  */
 final class QRStringJSONTest extends QRStringTestAbstract{
 
-	protected string $type = QRCode::OUTPUT_STRING_JSON;
+	protected string $type = QROutputInterface::STRING_JSON;
 
 	/**
 	 * @inheritDoc

+ 2 - 2
tests/Output/QRStringTEXTTest.php

@@ -11,14 +11,14 @@
 namespace chillerlan\QRCodeTest\Output;
 
 use chillerlan\QRCode\Data\QRMatrix;
-use chillerlan\QRCode\QRCode;
+use chillerlan\QRCode\Output\QROutputInterface;
 
 /**
  *
  */
 final class QRStringTEXTTest extends QRStringTestAbstract{
 
-	protected string $type = QRCode::OUTPUT_STRING_TEXT;
+	protected string $type = QROutputInterface::STRING_TEXT;
 
 	/**
 	 * @inheritDoc

+ 6 - 5
tests/QRCodeReaderTestAbstract.php

@@ -12,11 +12,12 @@
 
 namespace chillerlan\QRCodeTest;
 
-use chillerlan\Settings\SettingsContainerInterface;
-use Exception, Generator;
-use chillerlan\QRCode\Common\{EccLevel, Mode, Version};
 use chillerlan\QRCode\{QRCode, QROptions};
+use chillerlan\QRCode\Common\{EccLevel, Mode, Version};
+use chillerlan\QRCode\Output\QROutputInterface;
+use chillerlan\Settings\SettingsContainerInterface;
 use PHPUnit\Framework\TestCase;
+use Exception, Generator;
 use function range, sprintf, str_repeat, substr;
 
 /**
@@ -82,7 +83,7 @@ abstract class QRCodeReaderTestAbstract extends TestCase{
 	}
 
 	public function testReaderMultiSegment():void{
-		$this->options->outputType  = QRCode::OUTPUT_IMAGE_PNG;
+		$this->options->outputType  = QROutputInterface::GDIMAGE_PNG;
 		$this->options->imageBase64 = false;
 
 		$numeric  = '123456789012345678901234567890';
@@ -122,7 +123,7 @@ abstract class QRCodeReaderTestAbstract extends TestCase{
 	 * @dataProvider dataTestProvider
 	 */
 	public function testReadData(Version $version, EccLevel $ecc, string $expected):void{
-		$this->options->outputType       = QRCode::OUTPUT_IMAGE_PNG;
+		$this->options->outputType       = QROutputInterface::GDIMAGE_PNG;
 		$this->options->imageTransparent = false;
 		$this->options->eccLevel         = $ecc->getLevel();
 		$this->options->version          = $version->getVersionNumber();