@@ -403,7 +403,7 @@ class Container implements ContainerInterface
*/
static public function camelize($id)
{
- return preg_replace(array('/(?:^|_)+(.)/e', '/\.(.)/e'), array("strtoupper('\\1')", "'_'.strtoupper('\\1')"), $id);
+ return preg_replace_callback('/(^|_|\.)+(.)/', function ($match) { return ('.' === $match[1] ? '_' : '').strtoupper($match[2]); }, $id);
}
/**
@@ -366,6 +366,6 @@ class PropertyPath implements \IteratorAggregate
protected function camelize($property)
- return preg_replace(array('/(^|_)+(.)/e', '/\.(.)/e'), array("strtoupper('\\2')", "'_'.strtoupper('\\1')"), $property);
+ return preg_replace_callback('/(^|_|\.)+(.)/', function ($match) { return ('.' === $match[1] ? '_' : '').strtoupper($match[2]); }, $property);
@@ -49,7 +49,7 @@ class HeaderBag
$beautifier = function ($name) {
- return preg_replace('/\-(.)/e', "'-'.strtoupper('\\1')", ucfirst($name));
+ return preg_replace_callback('/\-(.)/', function ($match) { return '-'.strtoupper($match[1]); }, ucfirst($name));
};
$max = max(array_map('strlen', array_keys($this->headers))) + 1;