/** * @inheritdoc */ public function compare(DeltaInterface $version1, DeltaInterface $version2) { return strcmp($version1->getId(), $version2->getId()); }
/** * @inheritdoc */ public function validate(DeltaInterface $version) { return !empty($version->getId()); // basically: any DeltaInterface is valid for this collection }
/** * @inheritdoc */ public function delete(DeltaInterface $version) { return $this->mapper->delete($version->getId()); }
/** * {@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; }