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