| Conditions | 2 |
| Paths | 2 |
| Total Lines | 9 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | 6 | public static function classToSnakeCase($class, $trim = null) |
|
| 13 | { |
||
| 14 | 6 | $reflect = new \ReflectionClass($class); |
|
| 15 | 6 | $name = $reflect->getShortName(); |
|
| 16 | 6 | if (!is_null($trim)) { |
|
| 17 | 5 | $name = str_replace($trim, '', $name); |
|
| 18 | 5 | } |
|
| 19 | |||
| 20 | 6 | return ltrim(strtolower(preg_replace('/[A-Z]/', '_$0', $name)), '_'); |
|
| 21 | } |
||
| 23 |