Conditions | 4 |
Paths | 3 |
Total Lines | 9 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | public static function quoteField(string $field): string { |
||
12 | if(is_numeric($field) || !is_string($field)) { |
||
13 | throw new UnexpectedValueException('Field name is invalid'); |
||
14 | } |
||
15 | if(strpos($field, '`') !== false) { |
||
16 | return $field; |
||
17 | } |
||
18 | $parts = explode('.', $field); |
||
19 | return '`'.implode('`.`', $parts).'`'; |
||
20 | } |
||
22 |