/** * Get the response object * * @throws \UnexpectedValueException If the response doesn't implement the DispatcherResponseInterface * @return DispatcherResponse */ public function getResponse() { if (!$this->_response instanceof DispatcherResponseInterface) { $this->_response = parent::getResponse(); //Set the request in the response $this->_response->setRequest($this->getRequest()); if (!$this->_response instanceof DispatcherResponseInterface) { throw new \UnexpectedValueException('Response: ' . get_class($this->_response) . ' does not implement DispatcherResponseInterface'); } } return $this->_response; }