| Total Complexity | 4 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | 1 | class Strings extends Nette\Utils\Strings |
|
| 14 | { |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Converts string to PascalCase |
||
| 18 | * @param string $string |
||
| 19 | * @return string |
||
| 20 | */ |
||
| 21 | public static function toPascalCase(string $string): string |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Converts string to camelCase |
||
| 28 | * @param string $string |
||
| 29 | * @return string |
||
| 30 | */ |
||
| 31 | public static function toCamelCase(string $string): string |
||
| 32 | { |
||
| 33 | 1 | $func = fn($matches): string => self::upper($matches[2]); |
|
| 34 | |||
| 35 | 1 | return self::firstLower(self::replace($string, '/(_| |-)([a-zA-Z])/', $func)); |
|
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Converts first letter to lower case |
||
| 40 | * @param string $s |
||
| 41 | * @return string |
||
| 42 | */ |
||
| 43 | public static function firstLower(string $s): string |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Converts string to snake_case |
||
| 50 | * @param string $string |
||
| 51 | * @return string |
||
| 52 | */ |
||
| 53 | public static function toSnakeCase(string $string): string |
||
| 63 |