| @@ 2507-2517 (lines=11) @@ | ||
| 2504 | * |
|
| 2505 | * @return static |
|
| 2506 | */ |
|
| 2507 | public function kebabCase(): self |
|
| 2508 | { |
|
| 2509 | $words = \array_map( |
|
| 2510 | static function (self $word) { |
|
| 2511 | return $word->toLowerCase(); |
|
| 2512 | }, |
|
| 2513 | $this->words('', true) |
|
| 2514 | ); |
|
| 2515 | ||
| 2516 | return new static(\implode('-', $words), $this->encoding); |
|
| 2517 | } |
|
| 2518 | ||
| 2519 | /** |
|
| 2520 | * Returns the last $n characters of the string. |
|
| @@ 3828-3838 (lines=11) @@ | ||
| 3825 | * |
|
| 3826 | * @return static |
|
| 3827 | */ |
|
| 3828 | public function snakeCase(): self |
|
| 3829 | { |
|
| 3830 | $words = \array_map( |
|
| 3831 | static function (self $word) { |
|
| 3832 | return $word->toLowerCase(); |
|
| 3833 | }, |
|
| 3834 | $this->words('', true) |
|
| 3835 | ); |
|
| 3836 | ||
| 3837 | return new static(\implode('_', $words), $this->encoding); |
|
| 3838 | } |
|
| 3839 | ||
| 3840 | /** |
|
| 3841 | * Convert a string to snake_case. |
|