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