Exemplo n.º 1
0
 /**
  * @inheritdoc
  */
 public function compare(DeltaInterface $version1, DeltaInterface $version2)
 {
     return strcmp($version1->getId(), $version2->getId());
 }
Exemplo n.º 2
0
 /**
  * @inheritdoc
  */
 public function validate(DeltaInterface $version)
 {
     return !empty($version->getId());
     // basically: any DeltaInterface is valid for this collection
 }
Exemplo n.º 3
0
 /**
  * @inheritdoc
  */
 public function delete(DeltaInterface $version)
 {
     return $this->mapper->delete($version->getId());
 }
Exemplo n.º 4
0
 /**
  * {@inheritDoc}
  */
 public function add(DeltaInterface $value)
 {
     $key = $value->getId()->toString();
     if ($this->contains($key)) {
         throw new AlreadyExistsException(sprintf('Element with key "%s" already exists. Remove it first or use replace() if you want to overwrite it.', $key));
     }
     $this->elements[$key] = $value;
     return true;
 }