public function flushEvents(): StreamEvents {
        $events = $this->streamEvents->copy();

        $this->streamEvents = StreamEvents::make();

        return $events;
    }
public function flushEvents(): StreamEvents {
        $events = $this->streamEvents->copy();

        $this->streamEvents = StreamEvents::make();

        return $events;
    }
public function flushEvents ( ) : StreamEvents { $ events = $ this -> streamEvents -> copy ( ) ; $ this -> streamEvents = StreamEvents :: make ( ) ; return $ events ; }
returns and clears the internal pending stream events.
this DOES violate CQS, however it's important not to
retrieve or store these events multiple times. pass these
directly into the event store.

@return StreamEvents
returns and clears the internal pending stream events . this DOES violate CQS however it s important not to retrieve or store these events multiple times . pass these directly into the event store .