You are here

public function SimpleLcaResolver::resolve in Conflict 8

Finds the smallest revision id and calculates it's parent

Parameters

RevisionableInterface $revision1:

RevisionableInterface $revision2:

Return value

int parent of both revisions

Overrides ConflictAncestorResolverInterface::resolve

File

src/SimpleLcaResolver.php, line 25

Class

SimpleLcaResolver

Namespace

Drupal\conflict

Code

public function resolve(RevisionableInterface $revision1, RevisionableInterface $revision2, Graph $graph = NULL) {

  // Calculating revision ID from revision object.
  $revid1 = $revision1
    ->getRevisionId();
  $revid2 = $revision2
    ->getRevisionId();
  if ($revid1 < $revid2) {
    return $revid1 - 1;
  }
  return $revid2 - 1;
}