Permalink
Browse files

swap create_function for anonymous functions

  • Loading branch information...
MartinAmps committed Jul 7, 2015
1 parent 72ad9a3 commit 1ae6c4ec76272d0b55423645fb0f7f84ab92ffa9
Showing with 6 additions and 3 deletions.
  1. +6 −3 Services/Twilio/Resource.php
@@ -71,8 +71,9 @@ public function getResourceName($camelized = false)
public static function decamelize($word)
{
$callback = create_function('$matches',
'return strtolower(strlen("$matches[1]") ? "$matches[1]_$matches[2]" : "$matches[2]");');
$callback = function($m) {
return strtolower(strlen($m[1]) ? "$m[1]_$m[2]" : $m[2]);
};
return preg_replace_callback(
'/(^|[a-z])([A-Z])/',
@@ -90,7 +91,9 @@ public static function decamelize($word)
* @return string
*/
public static function camelize($word) {
$callback = create_function('$matches', 'return strtoupper("$matches[2]");');
$callback = function($m) {
return strtoupper($m[2]);
};
return preg_replace_callback('/(^|_)([a-z])/',
$callback,

0 comments on commit 1ae6c4e

Please sign in to comment.