You are here

class RevisionDiffFactory in Replication 8

Same name and namespace in other branches
  1. 8.2 src/RevisionDiffFactory.php \Drupal\replication\RevisionDiffFactory

Hierarchy

Expanded class hierarchy of RevisionDiffFactory

1 string reference to 'RevisionDiffFactory'
replication.services.yml in ./replication.services.yml
replication.services.yml
1 service uses RevisionDiffFactory
replication.revisiondiff_factory in ./replication.services.yml
Drupal\replication\RevisionDiffFactory

File

src/RevisionDiffFactory.php, line 9

Namespace

Drupal\replication
View source
class RevisionDiffFactory implements RevisionDiffFactoryInterface {

  /**
   * @var \Drupal\multiversion\Entity\Index\RevisionIndexInterface
   */
  protected $revIndex;

  /**
   * @var \Drupal\replication\RevisionDiff\RevisionDiffInterface[]
   */
  protected $instances = [];

  /**
   * @param \Drupal\multiversion\Entity\Index\RevisionIndexInterface $rev_index
   */
  public function __construct(RevisionIndexInterface $rev_index) {
    $this->revIndex = $rev_index;
  }

  /**
   * @inheritDoc
   */
  public function get(WorkspaceInterface $workspace) {
    if (!isset($this->instances[$workspace
      ->id()])) {
      $this->instances[$workspace
        ->id()] = new RevisionDiff($this->revIndex, $workspace);
    }
    return $this->instances[$workspace
      ->id()];
  }

}

Members