public static function camelToHyphen($str, $strtolower = true) {
        if (!is_string($str))
            return '';
        $str[0] = strtolower($str[0]);
        $func = create_function('$c', 'return "-" . $c[1];');
        $str = preg_replace_callback('/([A-Z])/', $func, $str);
        return ($strtolower) ? strtolower($str) : $str;
    }