/** * Override __toString() to send HTTP Content-Type header * * @return string */ public function __toString() { if (!headers_sent()) { header('Content-Type: text/xml; charset=' . strtolower($this->getEncoding())); } return parent::__toString(); }
/** * __toString() test */ public function test__toString() { $this->_response->setReturnValue('return value'); $xml = $this->_response->__toString(); $this->_testXmlResponse($xml); }