cascade\Util::snakeToCamelCase PHP Method

snakeToCamelCase() public static method

If the input is not a string, null is returned.
public static snakeToCamelCase ( string $input ) : null | string
$input string Input snake_case string
return null | string Output camelCase string
    public static function snakeToCamelCase($input)
    {
        if (!is_string($input)) {
            return null;
        }
        $output = preg_replace_callback('/(^|_)+(.)/', function ($match) {
            return strtoupper($match[2]);
        }, $input);
        return lcfirst($output);
    }

Usage Example

 /**
  * Test that constructor args were pulled properly
  *
  * Note that we need to deuplicate the CamelCase conversion here for old
  * fashioned classes
  */
 public function testInitConstructorArgs()
 {
     $expectedConstructorArgs = array();
     foreach ($this->getConstructorArgs() as $param) {
         $expectedConstructorArgs[Util::snakeToCamelCase($param->getName())] = $param;
     }
     $this->assertEquals($expectedConstructorArgs, $this->resolver->getConstructorArgs());
 }
All Usage Examples Of cascade\Util::snakeToCamelCase