Skip to content

Commit 8ed594e

Browse files
committed
Update string helper names
1 parent bccafa1 commit 8ed594e

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/SDK/Language.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ public function getFilters(): array
8484
return [];
8585
}
8686

87-
protected function toUpperCase(string $value): string
87+
protected function toUpperCaseWords(string $value): string
8888
{
89-
return ucfirst($this->helperCamelCase($value));
89+
return ucfirst($this->toCamelCase($value));
9090
}
9191

92-
protected function helperCamelCase($str): string
92+
protected function toCamelCase($str): string
9393
{
9494
$str = preg_replace('/[^a-z0-9' . implode("", []) . ']+/i', ' ', $str);
9595
$str = trim($str);

src/SDK/Language/Swift.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ protected function getReturnType(array $method, array $spec, string $generic): s
466466
return 'Any';
467467
}
468468

469-
$ret = $this->toUpperCase($method['responseModel']);
469+
$ret = $this->toUpperCaseWords($method['responseModel']);
470470

471471
if ($this->hasGenericType($method['responseModel'], $spec)) {
472472
$ret .= '<' . $generic . '>';
@@ -478,15 +478,15 @@ protected function getReturnType(array $method, array $spec, string $generic): s
478478
protected function getModelType(array $definition, array $spec, string $generic): string
479479
{
480480
if ($this->hasGenericType($definition['name'], $spec)) {
481-
return $this->toUpperCase($definition['name']) . '<' . $generic . '>';
481+
return $this->toUpperCaseWords($definition['name']) . '<' . $generic . '>';
482482
}
483-
return $this->toUpperCase($definition['name']);
483+
return $this->toUpperCaseWords($definition['name']);
484484
}
485485

486486
protected function getPropertyType(array $property, array $spec, string $generic): string
487487
{
488488
if (\array_key_exists('sub_schema', $property)) {
489-
$type = $this->toUpperCase($property['sub_schema']);
489+
$type = $this->toUpperCaseWords($property['sub_schema']);
490490

491491
if ($this->hasGenericType($property['sub_schema'], $spec)) {
492492
$type .= '<' . $generic . '>';

src/SDK/Language/Web.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public function getTypeName(array $parameter, array $method = []): string
208208
protected function populateGenerics(string $model, array $spec, array &$generics, bool $skipFirst = false)
209209
{
210210
if (!$skipFirst && $spec['definitions'][$model]['additionalProperties']) {
211-
$generics[] = $this->toUpperCase($model);
211+
$generics[] = $this->toUpperCaseWords($model);
212212
}
213213

214214
$properties = $spec['definitions'][$model]['properties'];
@@ -257,14 +257,14 @@ public function getReturn(array $method, array $spec): string
257257
$ret .= 'Models.';
258258
}
259259

260-
$ret .= $this->toUpperCase($method['responseModel']);
260+
$ret .= $this->toUpperCaseWords($method['responseModel']);
261261

262262
$models = [];
263263

264264
$this->populateGenerics($method['responseModel'], $spec, $models);
265265

266266
$models = array_unique($models);
267-
$models = array_filter($models, fn ($model) => $model != $this->toUpperCase($method['responseModel']));
267+
$models = array_filter($models, fn ($model) => $model != $this->toUpperCaseWords($method['responseModel']));
268268

269269
if (!empty($models)) {
270270
$ret .= '<' . implode(', ', $models) . '>';
@@ -284,9 +284,9 @@ public function getSubSchema(array $property, array $spec): string
284284
$generics = [];
285285
$this->populateGenerics($property['sub_schema'], $spec, $generics);
286286

287-
$generics = array_filter($generics, fn ($model) => $model != $this->toUpperCase($property['sub_schema']));
287+
$generics = array_filter($generics, fn ($model) => $model != $this->toUpperCaseWords($property['sub_schema']));
288288

289-
$ret .= $this->toUpperCase($property['sub_schema']);
289+
$ret .= $this->toUpperCaseWords($property['sub_schema']);
290290
if (!empty($generics)) {
291291
$ret .= '<' . implode(', ', $generics) . '>';
292292
}

0 commit comments

Comments
 (0)