Skip to content

Commit fed0eee

Browse files
authored
Merge pull request #24 from SharkyKZ/toVariable
Normalise::toVariable() cleanup
2 parents 33944ac + 907b191 commit fed0eee

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/Normalise.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,14 @@ public static function toUnderscoreSeparated($input)
125125
*/
126126
public static function toVariable($input)
127127
{
128-
// Remove dashes and underscores, then convert to camel case.
129-
$input = self::toSpaceSeparated($input);
128+
// Convert to camel case.
130129
$input = self::toCamelCase($input);
131130

132131
// Remove leading digits.
133132
$input = preg_replace('#^[0-9]+#', '', $input);
134133

135134
// Lowercase the first character.
136-
$first = substr($input, 0, 1);
137-
$first = strtolower($first);
138-
139-
// Replace the first character with the lowercase character.
140-
$input = substr_replace($input, $first, 0, 1);
135+
$input = lcfirst($input);
141136

142137
return $input;
143138
}

0 commit comments

Comments
 (0)