Not use deprecated code

This commit is contained in:
Pavel Dohnal
2018-01-18 16:28:30 +00:00
parent c70097085e
commit c4f285afca

View File

@@ -134,14 +134,16 @@ class Helpers {
if($capitalise_first_char) { if($capitalise_first_char) {
$str[0] = strtoupper($str[0]); $str[0] = strtoupper($str[0]);
} }
$func = create_function('$c', 'return strtoupper($c[1]);'); return preg_replace_callback('/_([a-z])/', function ($c) {
return preg_replace_callback('/_([a-z])/', $func, $str); return strtoupper($c[1]);
}, $str);
} }
static function camelCaseToUnderscore($str) { static function camelCaseToUnderscore($str) {
$str[0] = strtolower($str[0]); $str[0] = strtolower($str[0]);
$func = create_function('$c', 'return "_" . strtolower($c[1]);'); return preg_replace_callback('/([A-Z])/', function ($c) {
return preg_replace_callback('/([A-Z])/', $func, $str); return "_" . strtolower($c[1]);
}, $str);
} }
static function joinObject($object = array()) { static function joinObject($object = array()) {