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