Skip to content

Commit 1ae6c4e

Browse files
committed
swap create_function for anonymous functions
1 parent 72ad9a3 commit 1ae6c4e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Services/Twilio/Resource.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ public function getResourceName($camelized = false)
7171

7272
public static function decamelize($word)
7373
{
74-
$callback = create_function('$matches',
75-
'return strtolower(strlen("$matches[1]") ? "$matches[1]_$matches[2]" : "$matches[2]");');
74+
$callback = function($m) {
75+
return strtolower(strlen($m[1]) ? "$m[1]_$m[2]" : $m[2]);
76+
};
7677

7778
return preg_replace_callback(
7879
'/(^|[a-z])([A-Z])/',
@@ -90,7 +91,9 @@ public static function decamelize($word)
9091
* @return string
9192
*/
9293
public static function camelize($word) {
93-
$callback = create_function('$matches', 'return strtoupper("$matches[2]");');
94+
$callback = function($m) {
95+
return strtoupper($m[2]);
96+
};
9497

9598
return preg_replace_callback('/(^|_)([a-z])/',
9699
$callback,

0 commit comments

Comments
 (0)