@@ 1970-1980 (lines=11) @@ | ||
1967 | * |
|
1968 | * @return static |
|
1969 | */ |
|
1970 | public function kebabCase(): self |
|
1971 | { |
|
1972 | $words = \array_map( |
|
1973 | function ($word) { |
|
1974 | return $this->utf8::strtolower($word, $this->encoding); |
|
1975 | }, |
|
1976 | $this->words('', true) |
|
1977 | ); |
|
1978 | ||
1979 | return new static(\implode('-', $words), $this->encoding); |
|
1980 | } |
|
1981 | ||
1982 | /** |
|
1983 | * Returns the last $n characters of the string. |
|
@@ 3064-3074 (lines=11) @@ | ||
3061 | * |
|
3062 | * @return static |
|
3063 | */ |
|
3064 | public function snakeCase(): self |
|
3065 | { |
|
3066 | $words = \array_map( |
|
3067 | function ($word) { |
|
3068 | return $this->utf8::strtolower($word, $this->encoding); |
|
3069 | }, |
|
3070 | $this->words('', true) |
|
3071 | ); |
|
3072 | ||
3073 | return new static(\implode('_', $words), $this->encoding); |
|
3074 | } |
|
3075 | ||
3076 | /** |
|
3077 | * Convert a string to e.g.: "snake_case" |