public function write(Settings $settings) { if ($this->store->hasKey(self::$key)) { $this->store->update($settings); } else { $this->store->create($settings, self::$key); } }
public function create(Author $author) { $key = $author->getEmail(); if ($this->store->exists($key)) { throw new \Exception("Author with email [{$author->getEmail()}] already exists."); } $this->store->create($author, $key); }
public function create(Post $post) { $this->store->create($post, $post->getId()); }