aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/chillerlan/php-qrcode/src/Output/QROutputInterface.php
blob: 7d2315180cba552c566ea9172b46cb250df75f5b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<?php
/**
 * Interface QROutputInterface,
 *
 * @created      02.12.2015
 * @author       Smiley <smiley@chillerlan.net>
 * @copyright    2015 Smiley
 * @license      MIT
 */

namespace chillerlan\QRCode\Output;

use chillerlan\QRCode\Data\QRMatrix;

/**
 * Converts the data matrix into readable output
 */
interface QROutputInterface{

	/**
	 * @var string
	 * @deprecated 5.0.0 <no replacement>
	 * @see https://github.com/chillerlan/php-qrcode/issues/223
	 */
	public const MARKUP_HTML  = 'html';

	/**
	 * @var string
	 * @deprecated 5.0.0 <no replacement>
	 * @see https://github.com/chillerlan/php-qrcode/issues/223
	 */
	public const MARKUP_SVG   = 'svg';

	/**
	 * @var string
	 * @deprecated 5.0.0 <no replacement>
	 * @see https://github.com/chillerlan/php-qrcode/issues/223
	 */
	public const GDIMAGE_BMP  = 'bmp';

	/**
	 * @var string
	 * @deprecated 5.0.0 <no replacement>
	 * @see https://github.com/chillerlan/php-qrcode/issues/223
	 */
	public const GDIMAGE_GIF  = 'gif';

	/**
	 * @var string
	 * @deprecated 5.0.0 <no replacement>
	 * @see https://github.com/chillerlan/php-qrcode/issues/223
	 */
	public const GDIMAGE_JPG  = 'jpg';

	/**
	 * @var string
	 * @deprecated 5.0.0 <no replacement>
	 * @see https://github.com/chillerlan/php-qrcode/issues/223
	 */
	public const GDIMAGE_PNG  = 'png';

	/**
	 * @var string
	 * @deprecated 5.0.0 <no replacement>
	 * @see https://github.com/chillerlan/php-qrcode/issues/223
	 */
	public const GDIMAGE_WEBP = 'webp';

	/**
	 * @var string
	 * @deprecated 5.0.0 <no replacement>
	 * @see https://github.com/chillerlan/php-qrcode/issues/223
	 */
	public const STRING_JSON  = 'json';

	/**
	 * @var string
	 * @deprecated 5.0.0 <no replacement>
	 * @see https://github.com/chillerlan/php-qrcode/issues/223
	 */
	public const STRING_TEXT  = 'text';

	/**
	 * @var string
	 * @deprecated 5.0.0 <no replacement>
	 * @see https://github.com/chillerlan/php-qrcode/issues/223
	 */
	public const IMAGICK      = 'imagick';

	/**
	 * @var string
	 * @deprecated 5.0.0 <no replacement>
	 * @see https://github.com/chillerlan/php-qrcode/issues/223
	 */
	public const FPDF         = 'fpdf';

	/**
	 * @var string
	 * @deprecated 5.0.0 <no replacement>
	 * @see https://github.com/chillerlan/php-qrcode/issues/223
	 */
	public const EPS          = 'eps';

	/**
	 * @var string
	 * @deprecated 5.0.0 <no replacement>
	 * @see https://github.com/chillerlan/php-qrcode/issues/223
	 */
	public const CUSTOM       = 'custom';

	/**
	 * Map of built-in output modes => class FQN
	 *
	 * @var string[]
	 * @deprecated 5.0.0 <no replacement>
	 * @see        https://github.com/chillerlan/php-qrcode/issues/223
	 */
	public const MODES = [
		self::MARKUP_SVG   => QRMarkupSVG::class,
		self::MARKUP_HTML  => QRMarkupHTML::class,
		self::GDIMAGE_BMP  => QRGdImageBMP::class,
		self::GDIMAGE_GIF  => QRGdImageGIF::class,
		self::GDIMAGE_JPG  => QRGdImageJPEG::class,
		self::GDIMAGE_PNG  => QRGdImagePNG::class,
		self::GDIMAGE_WEBP => QRGdImageWEBP::class,
		self::STRING_JSON  => QRStringJSON::class,
		self::STRING_TEXT  => QRStringText::class,
		self::IMAGICK      => QRImagick::class,
		self::FPDF         => QRFpdf::class,
		self::EPS          => QREps::class,
	];

	/**
	 * Map of module type => default value
	 *
	 * @var bool[]
	 */
	public const DEFAULT_MODULE_VALUES = [
		// light
		QRMatrix::M_NULL             => false,
		QRMatrix::M_DARKMODULE_LIGHT => false,
		QRMatrix::M_DATA             => false,
		QRMatrix::M_FINDER           => false,
		QRMatrix::M_SEPARATOR        => false,
		QRMatrix::M_ALIGNMENT        => false,
		QRMatrix::M_TIMING           => false,
		QRMatrix::M_FORMAT           => false,
		QRMatrix::M_VERSION          => false,
		QRMatrix::M_QUIETZONE        => false,
		QRMatrix::M_LOGO             => false,
		QRMatrix::M_FINDER_DOT_LIGHT => false,
		// dark
		QRMatrix::M_DARKMODULE       => true,
		QRMatrix::M_DATA_DARK        => true,
		QRMatrix::M_FINDER_DARK      => true,
		QRMatrix::M_SEPARATOR_DARK   => true,
		QRMatrix::M_ALIGNMENT_DARK   => true,
		QRMatrix::M_TIMING_DARK      => true,
		QRMatrix::M_FORMAT_DARK      => true,
		QRMatrix::M_VERSION_DARK     => true,
		QRMatrix::M_QUIETZONE_DARK   => true,
		QRMatrix::M_LOGO_DARK        => true,
		QRMatrix::M_FINDER_DOT       => true,
	];

	/**
	 * Map of module type => readable name (for CSS etc.)
	 *
	 * @var string[]
	 */
	public const LAYERNAMES = [
		// light
		QRMatrix::M_NULL             => 'null',
		QRMatrix::M_DARKMODULE_LIGHT => 'darkmodule-light',
		QRMatrix::M_DATA             => 'data',
		QRMatrix::M_FINDER           => 'finder',
		QRMatrix::M_SEPARATOR        => 'separator',
		QRMatrix::M_ALIGNMENT        => 'alignment',
		QRMatrix::M_TIMING           => 'timing',
		QRMatrix::M_FORMAT           => 'format',
		QRMatrix::M_VERSION          => 'version',
		QRMatrix::M_QUIETZONE        => 'quietzone',
		QRMatrix::M_LOGO             => 'logo',
		QRMatrix::M_FINDER_DOT_LIGHT => 'finder-dot-light',
		// dark
		QRMatrix::M_DARKMODULE       => 'darkmodule',
		QRMatrix::M_DATA_DARK        => 'data-dark',
		QRMatrix::M_FINDER_DARK      => 'finder-dark',
		QRMatrix::M_SEPARATOR_DARK   => 'separator-dark',
		QRMatrix::M_ALIGNMENT_DARK   => 'alignment-dark',
		QRMatrix::M_TIMING_DARK      => 'timing-dark',
		QRMatrix::M_FORMAT_DARK      => 'format-dark',
		QRMatrix::M_VERSION_DARK     => 'version-dark',
		QRMatrix::M_QUIETZONE_DARK   => 'quietzone-dark',
		QRMatrix::M_LOGO_DARK        => 'logo-dark',
		QRMatrix::M_FINDER_DOT       => 'finder-dot',
	];

	/**
	 * @var      string
	 * @see      \chillerlan\QRCode\Output\QROutputAbstract::toBase64DataURI()
	 * @internal do not call this constant from the interface, but rather from one of the child classes
	 */
	public const MIME_TYPE = '';

	/**
	 * Determines whether the given value is valid
	 *
	 * @param mixed $value
	 */
	public static function moduleValueIsValid($value):bool;

	/**
	 * Generates the output, optionally dumps it to a file, and returns it
	 *
	 * please note that the value of QROptions::$cachefile is already evaluated at this point.
	 * if the output module is invoked manually, it has no effect at all.
	 * you need to supply the $file parameter here in that case (or handle the option value in your custom output module).
	 *
	 * @see \chillerlan\QRCode\QRCode::renderMatrix()
	 *
	 * @return mixed
	 */
	public function dump(?string $file = null);

}