/** * Get the user object * * @throws \UnexpectedValueException If the user doesn't implement the DispatcherUserInterface * @return DispatcherUserInterface */ public function getUser() { if (!$this->_user instanceof DispatcherUserInterface) { $this->_user = parent::getUser(); if (!$this->_user instanceof DispatcherUserInterface) { throw new \UnexpectedValueException('User: '******' does not implement DispatcherUserInterface'); } } return $this->_user; }