You are here

protected function ReversibleConfigDiffer::normalize in Update helper 8

Same name and namespace in other branches
  1. 2.x src/ReversibleConfigDiffer.php \Drupal\update_helper\ReversibleConfigDiffer::normalize()

Normalizes config for comparison.

Removes elements in the ignore list from the top level of configuration, and at each level of the array, removes empty arrays and sorts by array key, so that config from different storage can be compared meaningfully.

Parameters

array|null $config: Configuration array to normalize.

Return value

array Normalized configuration array.

Overrides ConfigDiffer::normalize

See also

ConfigDiffer::format()

ConfigDiffer::$ignore

File

src/ReversibleConfigDiffer.php, line 70

Class

ReversibleConfigDiffer
Overwrite of config updater differ.

Namespace

Drupal\update_helper

Code

protected function normalize($config) {

  // Recursively normalize remaining elements, if they are arrays.
  foreach ($config as $key => $value) {
    if (is_array($value)) {
      $config[$key] = $this
        ->normalize($value);
    }
  }

  // Sort and return.
  ksort($config);
  return $config;
}