1 | <?php |
||
7 | class Generator |
||
8 | { |
||
9 | /** |
||
10 | * Default Size |
||
11 | */ |
||
12 | const DEFAULT_SIZE = 100; |
||
13 | |||
14 | /** |
||
15 | * Default Color |
||
16 | */ |
||
17 | const DEFAULT_COLOR = '000000'; |
||
18 | |||
19 | /** |
||
20 | * Default background |
||
21 | * if false transparent |
||
22 | */ |
||
23 | const DEFAULT_BACKGROUND = false; // Transparent |
||
24 | |||
25 | /** |
||
26 | * @var QrCode|null |
||
27 | */ |
||
28 | protected $QRGenerator = null; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $content; |
||
34 | |||
35 | /** |
||
36 | * @var int |
||
37 | */ |
||
38 | protected $size; |
||
39 | |||
40 | /** |
||
41 | * @var array |
||
42 | */ |
||
43 | protected $color; |
||
44 | |||
45 | /** |
||
46 | * @var array |
||
47 | */ |
||
48 | protected $backgroundColor; |
||
49 | |||
50 | /** |
||
51 | * Generator constructor. |
||
52 | * |
||
53 | * @param string $content |
||
54 | * @param int $size |
||
55 | * @param mixed $color |
||
56 | * @param mixed $background |
||
57 | */ |
||
58 | 30 | public function __construct( |
|
69 | |||
70 | /** |
||
71 | * Generate QR Code |
||
72 | * |
||
73 | * @param string $content |
||
74 | * @param int $size |
||
75 | * @param mixed $color |
||
76 | * @param mixed $background |
||
77 | * |
||
78 | * @codeCoverageIgnore |
||
79 | * |
||
80 | * @return Generator |
||
81 | */ |
||
82 | public static function generate( |
||
91 | |||
92 | /** |
||
93 | * Gets the content |
||
94 | * |
||
95 | * @return string |
||
96 | */ |
||
97 | 6 | public function getContent() |
|
101 | |||
102 | /** |
||
103 | * Sets the content |
||
104 | * |
||
105 | * @param string $content |
||
106 | */ |
||
107 | 30 | public function setContent($content) |
|
111 | |||
112 | /** |
||
113 | * Gets the size |
||
114 | * |
||
115 | * @return int |
||
116 | */ |
||
117 | 15 | public function getSize() |
|
121 | |||
122 | /** |
||
123 | * Sets the size |
||
124 | * |
||
125 | * @param int $size |
||
126 | */ |
||
127 | 30 | public function setSize($size) |
|
131 | |||
132 | /** |
||
133 | * Gets the color |
||
134 | * |
||
135 | * @return array |
||
136 | */ |
||
137 | 21 | public function getColor() |
|
141 | |||
142 | /** |
||
143 | * Sets the color |
||
144 | * |
||
145 | * @param mixed $color |
||
146 | */ |
||
147 | 30 | public function setColor($color) |
|
151 | |||
152 | /** |
||
153 | * Gets the background color |
||
154 | * |
||
155 | * @return array |
||
156 | */ |
||
157 | 21 | public function getBackgroundColor() |
|
161 | |||
162 | /** |
||
163 | * Sets the background color |
||
164 | * |
||
165 | * @param mixed $backgroundColor |
||
166 | */ |
||
167 | 30 | public function setBackgroundColor($backgroundColor) |
|
171 | |||
172 | /** |
||
173 | * Process the Color Value |
||
174 | * |
||
175 | * @param mixed $color |
||
176 | * @param mixed $default |
||
177 | * |
||
178 | * @return array |
||
179 | */ |
||
180 | 30 | protected function processColor($color, $default) |
|
208 | |||
209 | /** |
||
210 | * Generates a QRCode |
||
211 | * |
||
212 | * @return QrCode |
||
213 | * |
||
214 | * @throws \Endroid\QrCode\Exceptions\ImageFunctionUnknownException |
||
215 | */ |
||
216 | 3 | public function create() |
|
227 | |||
228 | /** |
||
229 | * Returns the QRCode Generator Instance |
||
230 | * |
||
231 | * @codeCoverageIgnore |
||
232 | * |
||
233 | * @return QrCode |
||
234 | */ |
||
235 | protected function getGenerator() |
||
242 | } |