You are here

public function ComplexLcaResolver::resolve in Multiversion 8

Same name and namespace in other branches
  1. 8.2 src/Entity/Index/ComplexLcaResolver.php \Drupal\Multiversion\Entity\Index\ComplexLcaResolver::resolve()

Find the lowest common parent of two revisions from given graph.

Parameters

RevisionableInterface $revision1:

RevisionableInterface $revision2:

Graph $graph:

Return value

array Returns an array of vertices or an empty array.

Overrides ConflictAncestorResolverInterface::resolve

File

src/Entity/Index/ComplexLcaResolver.php, line 29

Class

ComplexLcaResolver

Namespace

Drupal\Multiversion\Entity\Index

Code

public function resolve(RevisionableInterface $revision1, RevisionableInterface $revision2, Graph $graph = NULL) {
  $lca = new LowestCommonAncestor($graph);
  $vertices = $graph
    ->getVertices()
    ->getMap();
  return $lca
    ->find($vertices[$revision1->_rev->value], $vertices[$revision2->_rev->value]);
}