@@ -98,21 +98,21 @@ protected function toCamelCase($str): string
98
98
return lcfirst ($ str );
99
99
}
100
100
101
- function toSnakeCase ($ string ) {
101
+ protected function toSnakeCase ($ str ): string {
102
102
// Replace alternative character sets
103
- $ string = iconv ('UTF-8 ' , 'ASCII//TRANSLIT ' , $ string );
103
+ $ str = iconv ('UTF-8 ' , 'ASCII//TRANSLIT ' , $ str );
104
104
105
105
// Replace seperating characters with underscores
106
106
// Includes: spaces, dashes, apostrophes, periods and slashes
107
- $ string = preg_replace ('/[ \'.\/-]/ ' , '_ ' , $ string );
107
+ $ str = preg_replace ('/[ \'.\/-]/ ' , '_ ' , $ str );
108
108
109
109
// Seperate camelCase with underscores
110
- $ string = preg_replace_callback ('/([a-z])([^a-z_])/ ' , function ($ matches ) {
110
+ $ str = preg_replace_callback ('/([a-z])([^a-z_])/ ' , function ($ matches ) {
111
111
return $ matches [1 ] . '_ ' . strtolower ($ matches [2 ]);
112
- }, $ string );
112
+ }, $ str );
113
113
114
114
// Remove ignorable characters
115
- return preg_replace ('/[^a-z0-9_]/ ' , '' , strtolower ($ string ));
115
+ return preg_replace ('/[^a-z0-9_]/ ' , '' , strtolower ($ str ));
116
116
}
117
117
118
118
protected function toUpperSnakeCase ($ str ): string
0 commit comments