src/Tools/ComposerHelperTrait.php
protected function mergeComposerObjects(\stdClass $original_composer, \stdClass $new_composer, callable  $callback = NULL) {
    foreach ($original_composer as $key => $values) {
      $is_array = is_array($values);
      $values = (array) $values;
      if (isset($new_composer->{$key})) {
        $value = (array) $new_composer->{$key};
        $values = array_merge($value, $values);
      }
      $new_composer->{$key} = $is_array ? $values : (object) $values;
    }
    if ($callback) {
      call_user_func($callback, $new_composer);
    }
    return $new_composer;
  }
protected function mergeComposerObjects(\stdClass $original_composer, \stdClass $new_composer, callable  $callback = NULL) {
    foreach ($original_composer as $key => $values) {
      $is_array = is_array($values);
      $values = (array) $values;
      if (isset($new_composer->{$key})) {
        $value = (array) $new_composer->{$key};
        $values = array_merge($value, $values);
      }
      $new_composer->{$key} = $is_array ? $values : (object) $values;
    }
    if ($callback) {
      call_user_func($callback, $new_composer);
    }
    return $new_composer;
  }
protected function mergeComposerObjects ( \ stdClass $ original_composer , \ stdClass $ new_composer , callable $ callback = NULL ) { foreach ( $ original_composer as $ key => $ values ) { $ is_array = is_array ( $ values ) ; $ values = ( array ) $ values ; if ( isset ( $ new_composer -> { $ key } ) ) { $ value = ( array ) $ new_composer -> { $ key } ; $ values = array_merge ( $ value , $ values ) ; } $ new_composer -> { $ key } = $ is_array ? $ values : ( object ) $ values ; } if ( $ callback ) { call_user_func ( $ callback , $ new_composer ) ; } return $ new_composer ; }
Merges two composer objects into one.

@param \stdClass $original_composer
The original composer.json file before it was removed as a php object.
@param \stdClass $new_composer
The new composer file to generate.
@param callable $callback
A callback if necessary to customize the composer object further.

@return \stdClass
An object representing the merged composer json files.
Merges two composer objects into one .