Automattic\WooCommerce\Admin\Features\OnboardingTasks

Task::convert_object_to_camelcase()public staticWC 1.0

Convert object keys to camelcase.

{} It's a method of the class: Task{}

No Hooks.

Return

Object.

Usage

$result = Task::convert_object_to_camelcase( $data );
$data(array) (required)
Data to convert.

Code of Task::convert_object_to_camelcase() WC 6.9.4

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;
}