| Conditions | 4 |
| Paths | 4 |
| Total Lines | 22 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public static function get(array $setting): CaptchaInterface |
||
| 31 | { |
||
| 32 | $type = $setting['config']['type'] ?? 'alnum'; |
||
| 33 | $length = $setting['config']['length'] ?? 8; |
||
| 34 | |||
| 35 | switch ($type) { |
||
| 36 | case 'numeric': |
||
| 37 | $imageCaptchaConfig['pool'] = '0123456789'; |
||
|
|
|||
| 38 | break; |
||
| 39 | |||
| 40 | case 'alpha': |
||
| 41 | $imageCaptchaConfig['pool'] = '0123456789abcdefghijklmnopqrstuvwxyz'; |
||
| 42 | break; |
||
| 43 | |||
| 44 | case 'alnum': |
||
| 45 | default: |
||
| 46 | $imageCaptchaConfig['pool'] = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
||
| 47 | } |
||
| 48 | |||
| 49 | $imageCaptchaConfig['word_length'] = $length; |
||
| 50 | |||
| 51 | return new ImageCaptcha($imageCaptchaConfig); |
||
| 52 | } |
||
| 53 | } |