| Conditions | 2 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | 15 | public static function base64From(string $content): string |
|
| 13 | { |
||
| 14 | try { |
||
| 15 | 15 | $img = Image::make($content)->encode('data-url'); |
|
| 16 | 12 | $base64 = substr($img->encoded, 22); |
|
| 17 | |||
| 18 | 12 | return 'base64:' . $base64; |
|
| 19 | 3 | } catch (ImageException $e) { |
|
| 20 | 3 | throw new InvalidCaptchaException; |
|
| 21 | } |
||
| 22 | } |
||
| 23 | } |
||
| 24 |