public function releaseEvents() { $events = $this->pendingEvents; $this->pendingEvents = []; return $events; }