| 1 |
<?php |
| 2 |
/** |
| 3 |
* Interface QROutputInterface, |
| 4 |
* |
| 5 |
* @created 02.12.2015 |
| 6 |
* @author Smiley <[email protected]> |
| 7 |
* @copyright 2015 Smiley |
| 8 |
* @license MIT |
| 9 |
*/ |
| 10 |
declare(strict_types=1); |
| 11 |
|
| 12 |
namespace chillerlan\QRCode\Output; |
| 13 |
|
| 14 |
use chillerlan\QRCode\Data\QRMatrix; |
| 15 |
|
| 16 |
/** |
| 17 |
* Converts the data matrix into readable output |
| 18 |
*/ |
| 19 |
interface QROutputInterface{ |
| 20 |
|
| 21 |
/** |
| 22 |
* Map of built-in output class FQN |
| 23 |
* |
| 24 |
* @var string[] |
| 25 |
* @see https://github.com/chillerlan/php-qrcode/issues/223 |
| 26 |
*/ |
| 27 |
public const MODES = [ |
| 28 |
QREps::class, |
| 29 |
QRFpdf::class, |
| 30 |
QRGdImageAVIF::class, |
| 31 |
QRGdImageBMP::class, |
| 32 |
QRGdImageGIF::class, |
| 33 |
QRGdImageJPEG::class, |
| 34 |
QRGdImagePNG::class, |
| 35 |
QRGdImageWEBP::class, |
| 36 |
QRImagick::class, |
| 37 |
QRInterventionImage::class, |
| 38 |
QRMarkupHTML::class, |
| 39 |
QRMarkupSVG::class, |
| 40 |
QRMarkupXML::class, |
| 41 |
QRStringJSON::class, |
| 42 |
QRStringText::class, |
| 43 |
]; |
| 44 |
|
| 45 |
/** |
| 46 |
* Map of module type => default value |
| 47 |
* |
| 48 |
* @var bool[] |
| 49 |
*/ |
| 50 |
public const DEFAULT_MODULE_VALUES = [ |
| 51 |
// light |
| 52 |
QRMatrix::M_NULL => false, |
| 53 |
QRMatrix::M_DARKMODULE_LIGHT => false, |
| 54 |
QRMatrix::M_DATA => false, |
| 55 |
QRMatrix::M_FINDER => false, |
| 56 |
QRMatrix::M_SEPARATOR => false, |
| 57 |
QRMatrix::M_ALIGNMENT => false, |
| 58 |
QRMatrix::M_TIMING => false, |
| 59 |
QRMatrix::M_FORMAT => false, |
| 60 |
QRMatrix::M_VERSION => false, |
| 61 |
QRMatrix::M_QUIETZONE => false, |
| 62 |
QRMatrix::M_LOGO => false, |
| 63 |
QRMatrix::M_FINDER_DOT_LIGHT => false, |
| 64 |
// dark |
| 65 |
QRMatrix::M_DARKMODULE => true, |
| 66 |
QRMatrix::M_DATA_DARK => true, |
| 67 |
QRMatrix::M_FINDER_DARK => true, |
| 68 |
QRMatrix::M_SEPARATOR_DARK => true, |
| 69 |
QRMatrix::M_ALIGNMENT_DARK => true, |
| 70 |
QRMatrix::M_TIMING_DARK => true, |
| 71 |
QRMatrix::M_FORMAT_DARK => true, |
| 72 |
QRMatrix::M_VERSION_DARK => true, |
| 73 |
QRMatrix::M_QUIETZONE_DARK => true, |
| 74 |
QRMatrix::M_LOGO_DARK => true, |
| 75 |
QRMatrix::M_FINDER_DOT => true, |
| 76 |
]; |
| 77 |
|
| 78 |
/** |
| 79 |
* Map of module type => readable name (for CSS etc.) |
| 80 |
* |
| 81 |
* @var string[] |
| 82 |
*/ |
| 83 |
public const LAYERNAMES = [ |
| 84 |
// light |
| 85 |
QRMatrix::M_NULL => 'null', |
| 86 |
QRMatrix::M_DARKMODULE_LIGHT => 'darkmodule-light', |
| 87 |
QRMatrix::M_DATA => 'data', |
| 88 |
QRMatrix::M_FINDER => 'finder', |
| 89 |
QRMatrix::M_SEPARATOR => 'separator', |
| 90 |
QRMatrix::M_ALIGNMENT => 'alignment', |
| 91 |
QRMatrix::M_TIMING => 'timing', |
| 92 |
QRMatrix::M_FORMAT => 'format', |
| 93 |
QRMatrix::M_VERSION => 'version', |
| 94 |
QRMatrix::M_QUIETZONE => 'quietzone', |
| 95 |
QRMatrix::M_LOGO => 'logo', |
| 96 |
QRMatrix::M_FINDER_DOT_LIGHT => 'finder-dot-light', |
| 97 |
// dark |
| 98 |
QRMatrix::M_DARKMODULE => 'darkmodule', |
| 99 |
QRMatrix::M_DATA_DARK => 'data-dark', |
| 100 |
QRMatrix::M_FINDER_DARK => 'finder-dark', |
| 101 |
QRMatrix::M_SEPARATOR_DARK => 'separator-dark', |
| 102 |
QRMatrix::M_ALIGNMENT_DARK => 'alignment-dark', |
| 103 |
QRMatrix::M_TIMING_DARK => 'timing-dark', |
| 104 |
QRMatrix::M_FORMAT_DARK => 'format-dark', |
| 105 |
QRMatrix::M_VERSION_DARK => 'version-dark', |
| 106 |
QRMatrix::M_QUIETZONE_DARK => 'quietzone-dark', |
| 107 |
QRMatrix::M_LOGO_DARK => 'logo-dark', |
| 108 |
QRMatrix::M_FINDER_DOT => 'finder-dot', |
| 109 |
]; |
| 110 |
|
| 111 |
/** |
| 112 |
* Note: do not call this constant from the interface, but rather from one of the child classes |
| 113 |
* |
| 114 |
* @var string |
| 115 |
* @see \chillerlan\QRCode\Output\QROutputAbstract::toBase64DataURI() |
| 116 |
*/ |
| 117 |
public const MIME_TYPE = ''; |
| 118 |
|
| 119 |
/** |
| 120 |
* Determines whether the given value is valid |
| 121 |
*/ |
| 122 |
public static function moduleValueIsValid(mixed $value):bool; |
| 123 |
|
| 124 |
/** |
| 125 |
* Generates the output, optionally dumps it to a file, and returns it |
| 126 |
* |
| 127 |
* please note that the value of QROptions::$cachefile is already evaluated at this point. |
| 128 |
* if the output module is invoked manually, it has no effect at all. |
| 129 |
* you need to supply the $file parameter here in that case (or handle the option value in your custom output module). |
| 130 |
* |
| 131 |
* @see \chillerlan\QRCode\QRCode::renderMatrix() |
| 132 |
*/ |
| 133 |
public function dump(string|null $file = null):mixed; |
| 134 |
|
| 135 |
} |