src/Tools/ComposerHelperTrait.php
protected function calculateRequirementChanges($replace_composer, $new_composer) {
    $changes = [
      'install' => [],
      'update' => [],
      'remove' => [],
    ];
    foreach (['require', 'require-dev'] as $key) {
      $old_requirements = !empty($replace_composer->{$key}) ? $replace_composer->{$key} : [];
      $new_requirements = !empty($new_composer->{$key}) ? $new_composer->{$key} : [];
      foreach ($new_requirements as $requirement => $version) {
        if (empty($old_requirements->{$requirement})) {
          $changes['install'][$requirement] = $version;
        }
        if ((!empty($old_requirements->{$requirement}) && Comparator::greaterThan($version, $old_requirements->{$requirement}))) {
          $changes['update'][$requirement] = $version;
        }
      }
      foreach ($old_requirements as $requirement => $version) {
        if (empty($new_requirements->{$requirement})) {
          $changes['remove'][] = $requirement;
        }
      }
    }
    return $changes;
  }
protected function calculateRequirementChanges($replace_composer, $new_composer) {
    $changes = [
      'install' => [],
      'update' => [],
      'remove' => [],
    ];
    foreach (['require', 'require-dev'] as $key) {
      $old_requirements = !empty($replace_composer->{$key}) ? $replace_composer->{$key} : [];
      $new_requirements = !empty($new_composer->{$key}) ? $new_composer->{$key} : [];
      foreach ($new_requirements as $requirement => $version) {
        if (empty($old_requirements->{$requirement})) {
          $changes['install'][$requirement] = $version;
        }
        if ((!empty($old_requirements->{$requirement}) && Comparator::greaterThan($version, $old_requirements->{$requirement}))) {
          $changes['update'][$requirement] = $version;
        }
      }
      foreach ($old_requirements as $requirement => $version) {
        if (empty($new_requirements->{$requirement})) {
          $changes['remove'][] = $requirement;
        }
      }
    }
    return $changes;
  }
protected function calculateRequirementChanges ( $ replace_composer , $ new_composer ) { $ changes = [ 'install' => [ ] , 'update' => [ ] , 'remove' => [ ] , ] ; foreach ( [ 'require' , 'require-dev' ] as $ key ) { $ old_requirements = ! empty ( $ replace_composer -> { $ key } ) ? $ replace_composer -> { $ key } : [ ] ; $ new_requirements = ! empty ( $ new_composer -> { $ key } ) ? $ new_composer -> { $ key } : [ ] ; foreach ( $ new_requirements as $ requirement => $ version ) { if ( empty ( $ old_requirements -> { $ requirement } ) ) { $ changes [ 'install' ] [ $ requirement ] = $ version ; } if ( ( ! empty ( $ old_requirements -> { $ requirement } ) && Comparator :: greaterThan ( $ version , $ old_requirements -> { $ requirement } ) ) ) { $ changes [ 'update' ] [ $ requirement ] = $ version ; } } foreach ( $ old_requirements as $ requirement => $ version ) { if ( empty ( $ new_requirements -> { $ requirement } ) ) { $ changes [ 'remove' ] [ ] = $ requirement ; } } } return $ changes ; }
Calculated requirements that need to be removed from the system.

@param $replace_composer
Composer object about to be replaced.
@param $new_composer
Composer object doing the replacing.

@return array
An array of requirements to install, update or remove.
Calculated requirements that need to be removed from the system .