| 1 | <?php |
||
| 16 | class Strings |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * |
||
| 20 | * @param string $input |
||
| 21 | * @param string $separator |
||
| 22 | * @return string |
||
| 23 | */ |
||
| 24 | public static function decamelize($input, $separator = '-') |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Will return CamelCased value from `input`. |
||
| 31 | * |
||
| 32 | * Example: |
||
| 33 | * |
||
| 34 | * ``` |
||
| 35 | * camelize('my-html-id'); |
||
| 36 | * ``` |
||
| 37 | * |
||
| 38 | * Will return `MyHtmlId`. |
||
| 39 | * |
||
| 40 | * Can also accept different separator or make first letter lower case: |
||
| 41 | * |
||
| 42 | * ``` |
||
| 43 | * camelize('\My\Php\ClassName', '\\', true); |
||
| 44 | * ``` |
||
| 45 | * |
||
| 46 | * Will return `myPhpClassName`. This might be useful for generating HTML id's |
||
| 47 | * from PHP class names. |
||
| 48 | * |
||
| 49 | * @param string $input |
||
| 50 | * @param string $separator |
||
| 51 | * @return string |
||
| 52 | */ |
||
| 53 | public static function camelize($input, $separator = '-', $lcFirst = false) |
||
| 64 | } |