Exemplo n.º 1
0
 public function write(Settings $settings)
 {
     if ($this->store->hasKey(self::$key)) {
         $this->store->update($settings);
     } else {
         $this->store->create($settings, self::$key);
     }
 }
Exemplo n.º 2
0
 public function __construct($file, \DateTimeImmutable $now = null)
 {
     $this->now = $now ?: new \DateTimeImmutable();
     $this->key = basename($file);
     $types = new TypeFactory();
     $registry = new SerializerRegistry();
     $registry->add(new ClassSerializerFactory(Event::class, new EventSerialilzer($registry, $types)));
     FileStore::registerDefaultSerializers($registry);
     $reflector = new Reflector(EventStream::class, $registry, $types);
     $serializer = $reflector->create(JsonSerializer::$CLASS);
     $this->store = new FileStore($serializer, dirname($file));
 }
 /**
  * @param string $id
  * @return null
  */
 public function delete($id)
 {
     $this->store->delete($id);
 }
 /**
  * @param string $email
  * @return Author
  */
 public function read($email)
 {
     return $this->store->read($email);
 }