public function lastEvent() { if ($count = count($this->events)) { return $this->events[$count - 1]; } throw new UndefinedEventException(0); }