| @@ 2044-2054 (lines=11) @@ | ||
| 2041 | * |
|
| 2042 | * @return static |
|
| 2043 | */ |
|
| 2044 | public function kebabCase(): self |
|
| 2045 | { |
|
| 2046 | $words = \array_map( |
|
| 2047 | static function (self $word) { |
|
| 2048 | return $word->toLowerCase(); |
|
| 2049 | }, |
|
| 2050 | $this->words('', true) |
|
| 2051 | ); |
|
| 2052 | ||
| 2053 | return new static(\implode('-', $words), $this->encoding); |
|
| 2054 | } |
|
| 2055 | ||
| 2056 | /** |
|
| 2057 | * Returns the last $n characters of the string. |
|
| @@ 3175-3185 (lines=11) @@ | ||
| 3172 | * |
|
| 3173 | * @return static |
|
| 3174 | */ |
|
| 3175 | public function snakeCase(): self |
|
| 3176 | { |
|
| 3177 | $words = \array_map( |
|
| 3178 | static function (self $word) { |
|
| 3179 | return $word->toLowerCase(); |
|
| 3180 | }, |
|
| 3181 | $this->words('', true) |
|
| 3182 | ); |
|
| 3183 | ||
| 3184 | return new static(\implode('_', $words), $this->encoding); |
|
| 3185 | } |
|
| 3186 | ||
| 3187 | /** |
|
| 3188 | * Convert a string to e.g.: "snake_case" |
|