src/Robo/Common/ComposerMunge.php
protected static function mergeKeyed($file1_contents, $file2_contents, $exclude_keys = []) {
    // Merge keyed arrays objects.
    $merge_keys = [
      'config',
      'extra',
    ];
    $output = $file1_contents;
    foreach ($merge_keys as $key) {
      // Set empty keys to empty placeholder arrays.
      if (!array_key_exists($key, $file1_contents)) {
        $file1_contents[$key] = [];
      }
      if (!array_key_exists($key, $file2_contents)) {
        $file2_contents[$key] = [];
      }

      // Merge!
      $output[$key] = ArrayManipulator::arrayMergeRecursiveDistinct($file1_contents[$key], $file2_contents[$key]);
    }

    return $output;
  }
protected static function mergeKeyed($file1_contents, $file2_contents, $exclude_keys = []) {
    // Merge keyed arrays objects.
    $merge_keys = [
      'config',
      'extra',
    ];
    $output = $file1_contents;
    foreach ($merge_keys as $key) {
      // Set empty keys to empty placeholder arrays.
      if (!array_key_exists($key, $file1_contents)) {
        $file1_contents[$key] = [];
      }
      if (!array_key_exists($key, $file2_contents)) {
        $file2_contents[$key] = [];
      }

      // Merge!
      $output[$key] = ArrayManipulator::arrayMergeRecursiveDistinct($file1_contents[$key], $file2_contents[$key]);
    }

    return $output;
  }
protected static function mergeKeyed ( $ file1_contents , $ file2_contents , $ exclude_keys = [ ] ) { // Merge keyed arrays objects. $ merge_keys = [ 'config' , 'extra' , ] ; $ output = $ file1_contents ; foreach ( $ merge_keys as $ key ) { // Set empty keys to empty placeholder arrays. if ( ! array_key_exists ( $ key , $ file1_contents ) ) { $ file1_contents [ $ key ] = [ ] ; } if ( ! array_key_exists ( $ key , $ file2_contents ) ) { $ file2_contents [ $ key ] = [ ] ; } // Merge! $ output [ $ key ] = ArrayManipulator :: arrayMergeRecursiveDistinct ( $ file1_contents [ $ key ] , $ file2_contents [ $ key ] ) ; } return $ output ; }
Merges specific keyed arrays and objects in composer.json files.

@param $file1_contents
@param $file2_contents
@param array $exclude_keys

@return mixed
Merges specific keyed arrays and objects in composer . json files .