public static function convertToSnakeCase($string)
{
$result = '';
$len = strlen($string);
for ($i = 0; $i < $len; ++$i) {
if ($i !== 0 && ctype_upper($string[$i])) {
$result .= '_' . strtolower($string[$i]);
} else {
$result .= strtolower($string[$i]);
}
}
return $result;
}