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)); }
private function getSerializer($class) { $reflector = new Reflector($class, $this->registry, $this->types); return $reflector->create(GenericSerializer::$CLASS); }