You are here

class SimpleLcaResolver in Conflict 8

Hierarchy

Expanded class hierarchy of SimpleLcaResolver

1 string reference to 'SimpleLcaResolver'
conflict.services.yml in ./conflict.services.yml
conflict.services.yml
1 service uses SimpleLcaResolver
conflict.simplelca_resolver in ./conflict.services.yml
Drupal\conflict\SimpleLcaResolver

File

src/SimpleLcaResolver.php, line 8

Namespace

Drupal\conflict
View source
class SimpleLcaResolver implements ConflictAncestorResolverInterface {

  /**
   * {@inheritdoc}
   */
  public function applies() {
    return TRUE;
  }

  /**
   * Finds the smallest revision id and calculates it's parent
   *
   * @param RevisionableInterface $revision1
   * @param RevisionableInterface $revision2
   *
   * @return int parent of both revisions
   */
  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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SimpleLcaResolver::applies public function Overrides ConflictAncestorResolverInterface::applies
SimpleLcaResolver::resolve public function Finds the smallest revision id and calculates it's parent Overrides ConflictAncestorResolverInterface::resolve