| Conditions | 3 |
| Paths | 3 |
| Total Lines | 9 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | 3 | public function execute(string $value): string |
|
| 19 | { |
||
| 20 | 3 | \preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $value, $matches); |
|
| 21 | 3 | $result = $matches[0]; |
|
| 22 | 3 | foreach ($result as &$match) { |
|
| 23 | 3 | $match = $match === \strtoupper($match) ? \strtolower($match) : \lcfirst($match); |
|
| 24 | } |
||
| 25 | |||
| 26 | 3 | return implode('_', $result); |
|
| 27 | } |
||
| 29 |