| Conditions | 3 |
| Paths | 3 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 40 | public static function display(array $attributes = []): string |
||
| 41 | { |
||
| 42 | $sitekey = config('captcha.turnstile.sitekey'); |
||
| 43 | |||
| 44 | if (empty($sitekey)) { |
||
| 45 | return ''; |
||
| 46 | } |
||
| 47 | |||
| 48 | $defaultAttributes = [ |
||
| 49 | 'class' => 'cf-turnstile', |
||
| 50 | 'data-sitekey' => $sitekey, |
||
| 51 | 'data-theme' => 'auto', |
||
| 52 | 'data-size' => 'normal', |
||
| 53 | ]; |
||
| 54 | |||
| 55 | $attributes = array_merge($defaultAttributes, $attributes); |
||
| 56 | |||
| 57 | $attributesString = ''; |
||
| 58 | foreach ($attributes as $key => $value) { |
||
| 59 | $attributesString .= sprintf('%s="%s" ', $key, htmlspecialchars($value)); |
||
| 60 | } |
||
| 61 | |||
| 62 | return sprintf('<div %s></div>', trim($attributesString)); |
||
| 63 | } |
||
| 73 |