Skip to content

Commit 117dd20

Browse files
committed
address comments.
1 parent 4fa0614 commit 117dd20

File tree

3 files changed

+3
-18
lines changed

3 files changed

+3
-18
lines changed

src/SDK/Language.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,29 +108,14 @@ protected function toCamelCase($str): string
108108

109109
$str = \preg_replace('/[^a-zA-Z0-9]+/', ' ', $str);
110110
$str = \trim($str);
111+
$str = strtolower($str);
111112
$str = \ucwords($str);
112113
$str = \str_replace(' ', '', $str);
113114
$str = \lcfirst($str);
114115

115116
return $str;
116117
}
117118

118-
protected function toLowerCamelCase($str): string
119-
{
120-
// Normalize the string to decompose accented characters
121-
$str = \Normalizer::normalize($str, \Normalizer::FORM_D);
122-
123-
// Remove accents and other residual non-ASCII characters
124-
$str = preg_replace('/\p{M}/u', '', $str);
125-
126-
// Replace non-alphanumeric characters with a space
127-
$str = preg_replace('/[^a-zA-Z0-9]+/', ' ', $str);
128-
$str = ucwords(strtolower($str));
129-
$str = lcfirst(str_replace(' ', '', $str));
130-
131-
return $str;
132-
}
133-
134119
protected function toSnakeCase($str): string
135120
{
136121
// Normalize the string to decompose accented characters

src/SDK/Language/Dart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ public function getFilters(): array
507507
return implode("\n", $value);
508508
}, ['is_safe' => ['html']]),
509509
new TwigFilter('caseEnumKey', function (string $value) {
510-
return $this->toLowerCamelCase($value);
510+
return $this->toCamelCase($value);
511511
}),
512512
];
513513
}

src/SDK/Language/Swift.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ public function getFilters(): array
471471
if (isset($this->getIdentifierOverrides()[$value])) {
472472
$value = $this->getIdentifierOverrides()[$value];
473473
}
474-
return $this->toLowerCamelCase($value);
474+
return $this->toCamelCase($value);
475475
}),
476476
];
477477
}

0 commit comments

Comments
 (0)