/** * Creates a new DomainMessage with all things equal, except metadata. * * @param Metadata $metadata Metadata to add * * @return DomainMessage */ public function andMetadata(Metadata $metadata) { $newMetadata = $this->metadata->merge($metadata); return new DomainMessage($this->id, $this->playhead, $newMetadata, $this->payload, $this->recordedOn); }