Conditions | 1 |
Paths | 1 |
Total Lines | 7 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
7 | public static function getValidVariableName(string $variableName): string |
||
8 | { |
||
9 | return preg_replace_callback('/^(\d+)/', static function (array $match) { |
||
10 | $f = new \NumberFormatter('en', \NumberFormatter::SPELLOUT); |
||
11 | $number = $f->format((int) $match[0]); |
||
12 | return preg_replace('/[^a-z]+/i', '_', $number); |
||
13 | }, $variableName); |
||
14 | } |
||
16 |