public function flush() : void { $this->recording = false; foreach ($this->events as $event) { $this->dispatcher ->dispatch($event); } $this->events = new EventCollection(); }