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;
  }