1 | <?php |
||
30 | class Captcha |
||
31 | { |
||
32 | |||
33 | /** |
||
34 | * @var Filesystem |
||
35 | */ |
||
36 | protected $files; |
||
37 | |||
38 | /** |
||
39 | * @var Repository |
||
40 | */ |
||
41 | protected $config; |
||
42 | |||
43 | /** |
||
44 | * @var ImageManager |
||
45 | */ |
||
46 | protected $imageManager; |
||
47 | |||
48 | /** |
||
49 | * @var Session |
||
50 | */ |
||
51 | protected $session; |
||
52 | |||
53 | /** |
||
54 | * @var Hasher |
||
55 | */ |
||
56 | protected $hasher; |
||
57 | |||
58 | /** |
||
59 | * @var Str |
||
60 | */ |
||
61 | protected $str; |
||
62 | |||
63 | /** |
||
64 | * @var ImageManager->canvas |
||
65 | */ |
||
66 | protected $canvas; |
||
67 | |||
68 | /** |
||
69 | * @var ImageManager->image |
||
70 | */ |
||
71 | protected $image; |
||
72 | |||
73 | /** |
||
74 | * @var array |
||
75 | */ |
||
76 | protected $backgrounds = []; |
||
77 | |||
78 | /** |
||
79 | * @var array |
||
80 | */ |
||
81 | protected $fonts = []; |
||
82 | |||
83 | /** |
||
84 | * @var array |
||
85 | */ |
||
86 | protected $fontColors = []; |
||
87 | |||
88 | /** |
||
89 | * @var int |
||
90 | */ |
||
91 | protected $length = 5; |
||
92 | |||
93 | /** |
||
94 | * @var int |
||
95 | */ |
||
96 | protected $width = 120; |
||
97 | |||
98 | /** |
||
99 | * @var int |
||
100 | */ |
||
101 | protected $height = 36; |
||
102 | |||
103 | /** |
||
104 | * @var int |
||
105 | */ |
||
106 | protected $angle = 15; |
||
107 | |||
108 | /** |
||
109 | * @var int |
||
110 | */ |
||
111 | protected $lines = 3; |
||
112 | |||
113 | /** |
||
114 | * @var string |
||
115 | */ |
||
116 | protected $characters; |
||
117 | |||
118 | /** |
||
119 | * @var string |
||
120 | */ |
||
121 | protected $text; |
||
122 | |||
123 | /** |
||
124 | * @var int |
||
125 | */ |
||
126 | protected $contrast = 0; |
||
127 | |||
128 | /** |
||
129 | * @var int |
||
130 | */ |
||
131 | protected $quality = 90; |
||
132 | |||
133 | /** |
||
134 | * @var int |
||
135 | */ |
||
136 | protected $sharpen = 0; |
||
137 | |||
138 | /** |
||
139 | * @var int |
||
140 | */ |
||
141 | protected $blur = 0; |
||
142 | |||
143 | /** |
||
144 | * @var bool |
||
145 | */ |
||
146 | protected $bgImage = true; |
||
147 | |||
148 | /** |
||
149 | * @var string |
||
150 | */ |
||
151 | protected $bgColor = '#ffffff'; |
||
152 | |||
153 | /** |
||
154 | * @var bool |
||
155 | */ |
||
156 | protected $invert = false; |
||
157 | |||
158 | /** |
||
159 | * @var bool |
||
160 | */ |
||
161 | protected $sensitive = false; |
||
162 | |||
163 | /** |
||
164 | * @var int |
||
165 | */ |
||
166 | protected $textLeftPadding = 4; |
||
167 | |||
168 | /** |
||
169 | * Constructor |
||
170 | * |
||
171 | * @param Filesystem $files |
||
172 | * @param Repository $config |
||
173 | * @param ImageManager $imageManager |
||
174 | * @param Session $session |
||
175 | * @param Hasher $hasher |
||
176 | * @param Str $str |
||
177 | * @throws Exception |
||
178 | * @internal param Validator $validator |
||
179 | */ |
||
180 | public function __construct( |
||
197 | |||
198 | /** |
||
199 | * @param string $config |
||
200 | * @return void |
||
201 | */ |
||
202 | protected function configure($config) |
||
212 | |||
213 | /** |
||
214 | * Create captcha image |
||
215 | * |
||
216 | * @param string $config |
||
217 | * @param boolean $api |
||
218 | * @return ImageManager->response |
||
|
|||
219 | */ |
||
220 | public function create($config = 'default', $api = false) |
||
285 | |||
286 | /** |
||
287 | * Image backgrounds |
||
288 | * |
||
289 | * @return string |
||
290 | */ |
||
291 | protected function background() |
||
295 | |||
296 | /** |
||
297 | * Generate captcha text |
||
298 | * |
||
299 | * @return string |
||
300 | */ |
||
301 | protected function generate() |
||
325 | |||
326 | /** |
||
327 | * Writing captcha text |
||
328 | */ |
||
329 | protected function text() |
||
350 | |||
351 | /** |
||
352 | * Image fonts |
||
353 | * |
||
354 | * @return string |
||
355 | */ |
||
356 | protected function font() |
||
360 | |||
361 | /** |
||
362 | * Random font size |
||
363 | * |
||
364 | * @return integer |
||
365 | */ |
||
366 | protected function fontSize() |
||
370 | |||
371 | /** |
||
372 | * Random font color |
||
373 | * |
||
374 | * @return array |
||
375 | */ |
||
376 | protected function fontColor() |
||
389 | |||
390 | /** |
||
391 | * Angle |
||
392 | * |
||
393 | * @return int |
||
394 | */ |
||
395 | protected function angle() |
||
399 | |||
400 | /** |
||
401 | * Random image lines |
||
402 | * |
||
403 | * @return \Intervention\Image\Image |
||
404 | */ |
||
405 | protected function lines() |
||
421 | |||
422 | /** |
||
423 | * Captcha check |
||
424 | * |
||
425 | * @param $value |
||
426 | * @return bool |
||
427 | */ |
||
428 | public function check($value) |
||
447 | |||
448 | /** |
||
449 | * Captcha check |
||
450 | * |
||
451 | * @param $value |
||
452 | * @return bool |
||
453 | */ |
||
454 | public function check_api($value, $key) |
||
458 | |||
459 | /** |
||
460 | * Generate captcha image source |
||
461 | * |
||
462 | * @param null $config |
||
463 | * @return string |
||
464 | */ |
||
465 | public function src($config = null) |
||
469 | |||
470 | /** |
||
471 | * Generate captcha image html tag |
||
472 | * |
||
473 | * @param null $config |
||
474 | * @param array $attrs HTML attributes supplied to the image tag where key is the attribute |
||
475 | * and the value is the attribute value |
||
476 | * @return string |
||
477 | */ |
||
478 | public function img($config = null, $attrs = []) |
||
490 | |||
491 | } |
||
492 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.