Total Complexity | 6 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | trait Base64Trait |
||
18 | { |
||
19 | /** @var string */ |
||
20 | private static string $base64_regex = '/^(?:[a-z0-9+\/]{4})*(?:[a-z0-9+\/]{2}==|[a-z0-9+\/]{3}=)?$/i'; |
||
21 | |||
22 | |||
23 | /*********************************************************************************** |
||
24 | * NOTE: Custom assertions may be added below this line. * |
||
25 | * They SHOULD be marked as `protected` to ensure the call is forced * |
||
26 | * through __callStatic(). * |
||
27 | * Assertions marked `public` are called directly and will * |
||
28 | * not handle any custom exception passed to it. * |
||
29 | ***********************************************************************************/ |
||
30 | |||
31 | |||
32 | /** |
||
33 | * Note: This test is not bullet-proof but prevents a string containing illegal characters |
||
34 | * from being passed and ensures the string roughly follows the correct format for a Base64 encoded string |
||
35 | * |
||
36 | * @param string $value |
||
37 | * @param string $message |
||
38 | */ |
||
39 | protected static function validBase64(string $value, string $message = ''): void |
||
62 |