/**
  * @see SpecialSetEntity::getValue()
  *
  * @since 0.4
  *
  * @param Fingerprint $fingerprint
  * @param string $languageCode
  *
  * @return string
  */
 protected function getValue(Fingerprint $fingerprint, $languageCode)
 {
     return $fingerprint->hasDescription($languageCode) ? $fingerprint->getDescription($languageCode)->getText() : '';
 }
Exemplo n.º 2
0
 /**
  * @expectedException OutOfBoundsException
  */
 public function testRemoveDescriptionMakesGetterThrowException()
 {
     $this->fingerprint->removeDescription('en');
     $this->fingerprint->getDescription('en');
 }
 /**
  * @param Fingerprint $fingerprint
  *
  * @return ChangeOp[]
  */
 private function getChangeOps(Fingerprint $fingerprint)
 {
     $changeOpFactory = $this->changeOpFactory;
     $changeOps = array();
     if ($this->label !== '') {
         if (!$fingerprint->hasLabel($this->languageCode) || $fingerprint->getLabel($this->languageCode)->getText() !== $this->label) {
             $changeOps['wbsetlabel'] = $changeOpFactory->newSetLabelOp($this->languageCode, $this->label);
         }
     } elseif ($fingerprint->hasLabel($this->languageCode)) {
         $changeOps['wbsetlabel'] = $changeOpFactory->newRemoveLabelOp($this->languageCode);
     }
     if ($this->description !== '') {
         if (!$fingerprint->hasDescription($this->languageCode) || $fingerprint->getDescription($this->languageCode)->getText() !== $this->description) {
             $changeOps['wbsetdescription'] = $changeOpFactory->newSetDescriptionOp($this->languageCode, $this->description);
         }
     } elseif ($fingerprint->hasDescription($this->languageCode)) {
         $changeOps['wbsetdescription'] = $changeOpFactory->newRemoveDescriptionOp($this->languageCode);
     }
     if (!empty($this->aliases)) {
         if (!$fingerprint->hasAliasGroup($this->languageCode) || $fingerprint->getAliasGroup($this->languageCode)->getAliases() !== $this->aliases) {
             $changeOps['wbsetaliases'] = $changeOpFactory->newSetAliasesOp($this->languageCode, $this->aliases);
         }
     } elseif ($fingerprint->hasAliasGroup($this->languageCode)) {
         $changeOps['wbsetaliases'] = $changeOpFactory->newRemoveAliasesOp($this->languageCode, $fingerprint->getAliasGroup($this->languageCode)->getAliases());
     }
     return $changeOps;
 }