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