public static function initialize($target, $parameters)
    {
        if (is_array($parameters)) {
            foreach ($parameters as $key => $value) {
                $method = 'set'.ucfirst(static::camelCase($key));
                if (method_exists($target, $method)) {
                    $target->$method($value);
                }
            }
        }
    }
public static function initialize($target, $parameters)
    {
        if (is_array($parameters)) {
            foreach ($parameters as $key => $value) {
                $method = 'set'.ucfirst(static::camelCase($key));
                if (method_exists($target, $method)) {
                    $target->$method($value);
                }
            }
        }
    }
public static function initialize ( $ target , $ parameters ) { if ( is_array ( $ parameters ) ) { foreach ( $ parameters as $ key => $ value ) { $ method = 'set' . ucfirst ( static :: camelCase ( $ key ) ) ; if ( method_exists ( $ target , $ method ) ) { $ target -> $ method ( $ value ) ; } } } }
Initialize an object with a given array of parameters

Parameters are automatically converted to camelCase. Any parameters which do
not match a setter on the target object are ignored.

@param mixed $target     The object to set parameters on
@param array $parameters An array of parameters to set
Initialize an object with a given array of parameters