Skip to content

Commit 868b962

Browse files
committed
:octocat: #13
1 parent e01d862 commit 868b962

File tree

2 files changed

+224
-209
lines changed

2 files changed

+224
-209
lines changed

src/QROptions.php

+3-209
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212

1313
namespace chillerlan\QRCode;
1414

15-
use chillerlan\QRCode\Data\QRMatrix;
16-
use chillerlan\Traits\{
17-
Container, ContainerInterface
18-
};
15+
use chillerlan\Traits\ContainerAbstract;
1916

2017
/**
2118
* @property int $version
@@ -48,209 +45,6 @@
4845
*
4946
* @property array $moduleValues
5047
*/
51-
class QROptions implements ContainerInterface{
52-
use Container;
53-
54-
/**
55-
* QR Code version number
56-
*
57-
* [1 ... 40] or QRCode::VERSION_AUTO
58-
*
59-
* @var int
60-
*/
61-
protected $version = QRCode::VERSION_AUTO;
62-
63-
/**
64-
* Minimum QR version (if $version = QRCode::VERSION_AUTO)
65-
*
66-
* @var int
67-
*/
68-
protected $versionMin = 1;
69-
70-
/**
71-
* Maximum QR version
72-
*
73-
* @var int
74-
*/
75-
protected $versionMax = 40;
76-
77-
/**
78-
* Error correct level
79-
*
80-
* QRCode::ECC_X where X is
81-
* L => 7%
82-
* M => 15%
83-
* Q => 25%
84-
* H => 30%
85-
*
86-
* @var int
87-
*/
88-
protected $eccLevel = QRCode::ECC_L;
89-
90-
/**
91-
* Mask Pattern to use
92-
*
93-
* [0...7] or QRCode::MASK_PATTERN_AUTO
94-
*
95-
* @var int
96-
*/
97-
protected $maskPattern = QRCode::MASK_PATTERN_AUTO;
98-
99-
/**
100-
* Add a "quiet zone" (margin) according to the QR code spec
101-
*
102-
* @var bool
103-
*/
104-
protected $addQuietzone = true;
105-
106-
/**
107-
* Size of the quiet zone
108-
*
109-
* internally clamped to [0 ... $moduleCount / 2], defaults to 4 modules
110-
*
111-
* @var int
112-
*/
113-
protected $quietzoneSize = 4;
114-
115-
/**
116-
* QRCode::OUTPUT_MARKUP_XXXX where XXXX = HTML, SVG
117-
* QRCode::OUTPUT_IMAGE_XXX where XXX = PNG, GIF, JPG
118-
* QRCode::OUTPUT_STRING_XXXX where XXXX = TEXT, JSON
119-
* QRCode::OUTPUT_CUSTOM
120-
*
121-
* @var string
122-
*/
123-
protected $outputType = QRCode::OUTPUT_IMAGE_PNG;
124-
125-
/**
126-
* the FQCN of the custom QROutputInterface if $outputType is set to QRCode::OUTPUT_CUSTOM
127-
*
128-
* @var string
129-
*/
130-
protected $outputInterface;
131-
132-
/**
133-
* /path/to/cache.file
134-
*
135-
* @var string
136-
*/
137-
protected $cachefile;
138-
139-
/**
140-
* newline string [HTML, SVG, TEXT]
141-
*
142-
* @var string
143-
*/
144-
protected $eol = PHP_EOL;
145-
146-
/**
147-
* size of a QR code pixel [SVG, IMAGE_*]
148-
* HTML -> via CSS
149-
*
150-
* @var int
151-
*/
152-
protected $scale = 5;
153-
154-
/**
155-
* a common css class
156-
*
157-
* @var string
158-
*/
159-
protected $cssClass;
160-
161-
/**
162-
* SVG opacity
163-
*
164-
* @var float
165-
*/
166-
protected $svgOpacity = 1.0;
167-
168-
/**
169-
* anything between <defs>
170-
*
171-
* @see https://developer.mozilla.org/docs/Web/SVG/Element/defs
172-
*
173-
* @var string
174-
*/
175-
protected $svgDefs = '<style>rect{shape-rendering:crispEdges}</style>';
176-
177-
/**
178-
* string substitute for dark
179-
*
180-
* @var string
181-
*/
182-
protected $textDark = '🔴';
183-
184-
/**
185-
* string substitute for light
186-
*
187-
* @var string
188-
*/
189-
protected $textLight = '';
190-
191-
/**
192-
* toggle base64 or raw image data
193-
*
194-
* @var bool
195-
*/
196-
protected $imageBase64 = true;
197-
198-
/**
199-
* toggle transparency, not supported by jpg
200-
*
201-
* @var bool
202-
*/
203-
protected $imageTransparent = true;
204-
205-
/**
206-
* @see imagecolortransparent()
207-
*
208-
* @var array [R, G, B]
209-
*/
210-
protected $imageTransparencyBG = [255, 255, 255];
211-
212-
/**
213-
* @see imagepng()
214-
*
215-
* @var int
216-
*/
217-
protected $pngCompression = -1;
218-
219-
/**
220-
* @see imagejpeg()
221-
*
222-
* @var int
223-
*/
224-
protected $jpegQuality = 85;
225-
226-
/**
227-
* Module values map
228-
*
229-
* HTML : #ABCDEF, cssname, rgb(), rgba()...
230-
* IMAGE: [63, 127, 255] // R, G, B
231-
*
232-
* @var array
233-
*/
234-
protected $moduleValues = [
235-
// light
236-
QRMatrix::M_DATA => false, // 4
237-
QRMatrix::M_FINDER => false, // 6
238-
QRMatrix::M_SEPARATOR => false, // 8
239-
QRMatrix::M_ALIGNMENT => false, // 10
240-
QRMatrix::M_TIMING => false, // 12
241-
QRMatrix::M_FORMAT => false, // 14
242-
QRMatrix::M_VERSION => false, // 16
243-
QRMatrix::M_QUIETZONE => false, // 18
244-
QRMatrix::M_TEST => false, // 255
245-
// dark
246-
QRMatrix::M_DARKMODULE << 8 => true, // 512
247-
QRMatrix::M_DATA << 8 => true, // 1024
248-
QRMatrix::M_FINDER << 8 => true, // 1536
249-
QRMatrix::M_ALIGNMENT << 8 => true, // 2560
250-
QRMatrix::M_TIMING << 8 => true, // 3072
251-
QRMatrix::M_FORMAT << 8 => true, // 3584
252-
QRMatrix::M_VERSION << 8 => true, // 4096
253-
QRMatrix::M_TEST << 8 => true, // 65280
254-
];
255-
48+
class QROptions extends ContainerAbstract{
49+
use QROptionsTrait;
25650
}

0 commit comments

Comments
 (0)