-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,39 +105,48 @@ public function upperCase(string $string): string | |
|
||
private function glueDash(array $words, Closure $converter): string | ||
{ | ||
/** @var list<string> $words */ | ||
return implode('-', array_map($converter, $words)); | ||
return implode('-', $this->map($converter, $words)); | ||
} | ||
|
||
private function glueDot(array $words, Closure $converter): string | ||
{ | ||
/** @var list<string> $words */ | ||
return implode('.', array_map($converter, $words)); | ||
return implode('.', $this->map($converter, $words)); | ||
} | ||
|
||
private function glueSpace(array $words, Closure $converter): string | ||
{ | ||
/** @var list<string> $words */ | ||
return implode(' ', array_map($converter, $words)); | ||
return implode(' ', $this->map($converter, $words)); | ||
} | ||
|
||
private function glueUnderscore(array $words, Closure $converter): string | ||
{ | ||
/** @var list<string> $words */ | ||
return implode('_', array_map($converter, $words)); | ||
return implode('_', $this->map($converter, $words)); | ||
} | ||
|
||
private function glueUppercase(array $words, Closure $converter): string | ||
{ | ||
/** @var list<string> $words */ | ||
return implode('', array_map($converter, $words)); | ||
return implode('', $this->map($converter, $words)); | ||
} | ||
|
||
private function isUppercaseWord(string $string): bool | ||
{ | ||
return preg_match('#^\p{Lu}+$#u', $string) === 1; | ||
Check warning on line 133 in src/CaseConverter.php GitHub Actions / automation / Infection on ubuntu with PHP 8.3 and Composer locked
Check warning on line 133 in src/CaseConverter.php GitHub Actions / automation / Infection on ubuntu with PHP 8.3 and Composer locked
Check warning on line 133 in src/CaseConverter.php GitHub Actions / automation / Infection on ubuntu with PHP 8.3 and Composer locked
Check warning on line 133 in src/CaseConverter.php GitHub Actions / automation / Infection on ubuntu with PHP 8.3 and Composer locked
Check warning on line 133 in src/CaseConverter.php GitHub Actions / automation / Infection on ubuntu with PHP 8.3 and Composer locked
Check warning on line 133 in src/CaseConverter.php GitHub Actions / automation / Infection on ubuntu with PHP 8.3 and Composer locked
Check warning on line 133 in src/CaseConverter.php GitHub Actions / automation / Infection on ubuntu with PHP 8.3 and Composer locked
Check warning on line 133 in src/CaseConverter.php GitHub Actions / automation / Infection on ubuntu with PHP 8.3 and Composer locked
Check warning on line 133 in src/CaseConverter.php GitHub Actions / automation / Infection on ubuntu with PHP 8.3 and Composer locked
|
||
} | ||
|
||
/** | ||
* @return list<string> | ||
*/ | ||
private function map(Closure $converter, array $words): array | ||
{ | ||
/** | ||
* @var list<string> $words | ||
* @var Closure(string):string $converter | ||
* | ||
* @return list<string> | ||
*/ | ||
return array_map($converter, $words); | ||
} | ||
|
||
private function split(string $string): array | ||
{ | ||
if (str_contains($string, '_')) { | ||
|