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