| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | protected function normalizeString($string) |
||
| 29 | { |
||
| 30 | if (false === strpos($string, '_')) { |
||
| 31 | return $string; |
||
| 32 | } |
||
| 33 | |||
| 34 | // Custom logic to skip locale codes (e.g. nl_NL) |
||
| 35 | if (1 === preg_match('/^[a-z]{2}_[A-Z]{2}$/', $string)) { |
||
| 36 | return $string; |
||
| 37 | } |
||
| 38 | |||
| 39 | return preg_replace_callback('/_([a-zA-Z0-9])/', function ($matches) { |
||
| 40 | return strtoupper($matches[1]); |
||
| 41 | }, $string); |
||
| 42 | } |
||
| 43 | } |
||
| 44 |