public function andMetadata(Metadata $metadata): self
    {
        $newMetadata = $this->metadata->merge($metadata);

        return new self($this->id, $this->playhead, $newMetadata, $this->payload, $this->recordedOn);
    }
public function andMetadata(Metadata $metadata): self
    {
        $newMetadata = $this->metadata->merge($metadata);

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

@param Metadata $metadata Metadata to add
Creates a new DomainMessage with all things equal except metadata .