Skip to content

Commit

Permalink
Fixes camelize function from the humanize function it somehow was. Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lonnieezell committed Jun 30, 2017
1 parent 9a1ffb5 commit 60ab63b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions system/Helpers/inflector_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function plural(string $string): string
*/
function camelize(string $string): string
{
return ucwords(preg_replace('/[\s_]+/', ' ', $string));
return lcfirst(str_replace(' ', '', ucwords(preg_replace('/[\s_]+/', ' ', $string))));
}

}
Expand Down Expand Up @@ -382,4 +382,4 @@ function ordinalize(int $integer): string
return $integer . ordinal($integer);
}

}
}
6 changes: 3 additions & 3 deletions tests/system/Helpers/InflectorHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ public function testCamelize()
{
$strings =
[
'hello from codeIgniter 4' => 'Hello From CodeIgniter 4',
'hello_world' => 'Hello World'
'hello from codeIgniter 4' => 'helloFromCodeIgniter4',
'hello_world' => 'helloWorld'
];

foreach ($strings as $lowerCasedString => $camelizedString)
Expand Down Expand Up @@ -227,4 +227,4 @@ public function testOrdinalize()
}
}

}
}

0 comments on commit 60ab63b

Please sign in to comment.