You are here

protected static function BackgroundImageSettings::snakeCaseToCamelCase in Background Image 8

Same name and namespace in other branches
  1. 2.x src/BackgroundImageSettings.php \Drupal\background_image\BackgroundImageSettings::snakeCaseToCamelCase()
  2. 2.0.x src/BackgroundImageSettings.php \Drupal\background_image\BackgroundImageSettings::snakeCaseToCamelCase()

Converts snake_case_keys into camelCaseKeys.

Parameters

array $array: An array to iterate over.

Return value

array The converted array.

1 call to BackgroundImageSettings::snakeCaseToCamelCase()
BackgroundImageSettings::drupalSettings in src/BackgroundImageSettings.php
Retrieves the data currently set as a drupalSettings array.

File

src/BackgroundImageSettings.php, line 209

Class

BackgroundImageSettings

Namespace

Drupal\background_image

Code

protected static function snakeCaseToCamelCase(array $array = []) {
  $converter = new CamelCaseToSnakeCaseNameConverter();
  $data = [];
  foreach ($array as $key => $value) {
    $data[$converter
      ->denormalize($key)] = is_array($value) ? self::snakeCaseToCamelCase($value) : $value;
  }
  ksort($data);
  return $data;
}