Automattic\WooCommerce\Admin\Features\OnboardingTasks
Task::convert_object_to_camelcase
Convert object keys to camelcase.
Method of the class: Task{}
No Hooks.
Returns
Object.
Usage
$result = Task::convert_object_to_camelcase( $data );
- $data(array) (required)
- Data to convert.
Task::convert_object_to_camelcase() Task::convert object to camelcase code WC 10.7.0
public static function convert_object_to_camelcase( $data ) {
if ( ! is_array( $data ) ) {
return $data;
}
$new_object = (object) array();
foreach ( $data as $key => $value ) {
$new_key = lcfirst( implode( '', array_map( 'ucfirst', explode( '_', $key ) ) ) );
$new_object->$new_key = $value;
}
return $new_object;
}