/**
  * @param SnakList $qualifiers
  * @param Summary|null $summary
  *
  * @throws ChangeOpException
  */
 protected function removeQualifier(SnakList $qualifiers, Summary $summary = null)
 {
     if (!$qualifiers->hasSnakHash($this->snakHash)) {
         throw new ChangeOpException("Qualifier with hash {$this->snakHash} does not exist");
     }
     $removedQualifier = $qualifiers->getSnak($this->snakHash);
     $qualifiers->removeSnakHash($this->snakHash);
     $this->updateSummary($summary, 'remove', '', $this->getSnakSummaryArgs($removedQualifier));
 }
Ejemplo n.º 2
0
 /**
  * @since 0.4
  *
  * @param SnakList $qualifiers
  * @param Summary $summary
  *
  * @throws ChangeOpException
  */
 protected function setQualifier(SnakList $qualifiers, Summary $summary = null)
 {
     if (!$qualifiers->hasSnakHash($this->snakHash)) {
         throw new ChangeOpException("Qualifier with hash {$this->snakHash} does not exist");
     }
     if ($qualifiers->hasSnak($this->snak)) {
         throw new ChangeOpException('The statement has already a qualifier with hash ' . $this->snak->getHash());
     }
     $qualifiers->removeSnakHash($this->snakHash);
     $qualifiers->addSnak($this->snak);
     $this->updateSummary($summary, 'update', '', $this->getSnakSummaryArgs($this->snak));
 }