| Conditions | 3 |
| Paths | 3 |
| Total Lines | 8 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | public function fromCamelToSnake($key) |
||
| 39 | {
|
||
| 40 | preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $key, $matches);
|
||
| 41 | $ret = $matches[0]; |
||
| 42 | foreach ($ret as &$match) {
|
||
| 43 | $match = $match == strtoupper($match) ? strtolower($match) : lcfirst($match); |
||
| 44 | } |
||
| 45 | return implode('_', $ret);
|
||
| 46 | } |
||
| 62 | } |