| 1 | <?php |
||
| 7 | class ColumnNameSanitizer |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Based on maximum column name length. |
||
| 11 | */ |
||
| 12 | public const MAX_COLUMN_NAME_LENGTH = 64; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Column names are alphanumeric strings that can contain |
||
| 16 | * underscores (`_`) but can't start with a number. |
||
| 17 | */ |
||
| 18 | private const VALID_COLUMN_NAME_REGEX = "/^(?![0-9])[A-Za-z0-9_-]*$/"; |
||
| 19 | |||
| 20 | public static function sanitize(string $column): string |
||
| 32 | |||
| 33 | public static function sanitizeArray(array $columns): array |
||
| 37 | } |
||
| 38 |