Commit 87afa711 authored by TravisCarden's avatar TravisCarden

Moved ChecklistapiChecklist::strtolowercamel() to checklistapi_convert_string_to_lower_camel().

parent 396c7f9f
......@@ -51,6 +51,22 @@ function checklistapi_checklist_load($id) {
return ($definition) ? new ChecklistapiChecklist($definition) : FALSE;
}
/**
* Converts a string to lowerCamel case, suitably for a class property name.
*
* @param string $string
* The input string.
*
* @return string
* The input string converted to camelCase.
*/
function checklistapi_convert_string_to_lower_camel($string) {
$string = str_replace('_', ' ', $string);
$string = ucwords($string);
$string = str_replace(' ', '', $string);
return lcfirst($string);
}
/**
* Gets checklist definitions.
*
......
......@@ -93,7 +93,7 @@ class ChecklistapiChecklist {
unset($definition[$group_key]);
}
foreach ($definition as $key => $value) {
$property_name = $this->strtolowercamel(substr($key, 1));
$property_name = checklistapi_convert_string_to_lower_camel(substr($key, 1));
$this->$property_name = $value;
}
$this->savedProgress = variable_get($this->getSavedProgressVariableName(), array());
......@@ -190,22 +190,6 @@ class ChecklistapiChecklist {
));
}
/**
* Converts a string to lowerCamel case, suitably for a class property name.
*
* @param string $string
* The input string.
*
* @return string
* The input string converted to camelCase.
*/
protected function strtolowercamel($string) {
$string = str_replace('_', ' ', $string);
$string = ucwords($string);
$string = str_replace(' ', '', $string);
return lcfirst($string);
}
/**
* Determines whether the current user has access to the checklist.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment