ComplexLcaResolver.php in Multiversion 8.2
File
src/Entity/Index/ComplexLcaResolver.php
View source
<?php
namespace Drupal\Multiversion\Entity\Index;
use Drupal\conflict\ConflictAncestorResolverInterface;
use Drupal\Core\Entity\RevisionableInterface;
use Relaxed\LCA\LowestCommonAncestor;
use Fhaculty\Graph\Graph;
class ComplexLcaResolver implements ConflictAncestorResolverInterface {
public function applies() {
return TRUE;
}
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]);
}
}