ReplicationTask.php in Replication 8.2
File
src/ReplicationTask/ReplicationTask.php
View source
<?php
namespace Drupal\replication\ReplicationTask;
use InvalidArgumentException;
class ReplicationTask implements ReplicationTaskInterface {
protected $filter;
protected $parameters;
protected $limit = 100;
private $bulkDocsLimit = 100;
protected $style = 'all_docs';
protected $heartbeat = 10000;
protected $docIds = NULL;
private $sinceSeq = 0;
protected $createTarget = FALSE;
protected $continuous = FALSE;
public function setFilter($filter = NULL) {
$this->filter = $filter;
return $this;
}
public function getFilter() {
return $this->filter;
}
public function setParameters(array $parameters = NULL) {
if ($parameters == NULL) {
$parameters = [];
}
$this->parameters = $parameters;
return $this;
}
public function setLimit($limit) {
$this->limit = $limit;
return $this;
}
public function setBulkDocsLimit($bulkDocsLimit) {
$this->bulkDocsLimit = $bulkDocsLimit;
return $this;
}
public function setParameter($name, $value) {
if (!is_array($this->parameters)) {
$this
->setParameters([]);
}
$this->parameters[$name] = $value;
return $this;
}
public function setSinceSeq($sinceSeq) {
$this->sinceSeq = $sinceSeq;
return $this;
}
public function setStyle($style) {
$this->style = $style;
}
public function getParameters() {
return $this->parameters;
}
public function getParametersAsArray() {
return $this->parameters
->all();
}
public function getParameter($name) {
return $this->parameters
->get($name);
}
public function getLimit() {
return $this->limit;
}
public function getBulkDocsLimit() {
return $this->bulkDocsLimit;
}
public function getSinceSeq() {
return $this->sinceSeq;
}
public function getStyle() {
return $this->style;
}
public function getDocIds() {
return $this->docIds;
}
public function setDocIds($docIds) {
if ($docIds != NULL) {
sort($docIds);
if ($this->filter === NULL) {
$this->filter = '_doc_ids';
}
elseif ($this->filter !== '_doc_ids') {
throw new InvalidArgumentException('If docIds is specified, the filter should be set as _doc_ids');
}
}
$this->docIds = $docIds;
return $this;
}
public function getHeartbeat() {
return $this->heartbeat;
}
public function setHeartbeat($heartbeat) {
$this->heartbeat = $heartbeat;
return $this;
}
public function getCreateTarget() {
return $this->createTarget;
}
public function setCreateTarget($createTarget) {
$this->createTarget = $createTarget;
return $this;
}
public function getContinuous() {
return $this->continuous;
}
public function setContinuous($continuous) {
$this->continuous = $continuous;
return $this;
}
}