createdAt = new \DateTimeImmutable('now'); $this->reHash(); } /** * Create hash for data change as identifier * * @return void * * @since 1.0.0 */ public function reHash() : void { $this->hash = \bin2hex(\random_bytes(16)); } /** * Get hash * * @return string * * @since 1.0.0 */ public function getHash() : string { return $this->hash; } /** * {@inheritdoc} */ public function toArray() : array { return [ 'id' => $this->id, 'data' => $this->data, ]; } /** * {@inheritdoc} */ public function jsonSerialize() : mixed { return $this->toArray(); } }