*/ namespace Whoops\Handler; /** * Catches an exception and converts it to an Soap XML * response. * * @author Markus Staab */ class SoapResponseHandler extends Handler { /** * @return int */ public function handle() { $exception = $this->getException(); echo $this->toXml($exception); return Handler::QUIT; } /** * Converts a Exception into a SoapFault XML */ private function toXml(\Exception $exception) { $xml = ''; $xml .= ''; $xml .= ''; $xml .= ' '; $xml .= ' '; $xml .= ' '. htmlspecialchars($exception->getCode()) .''; $xml .= ' '. htmlspecialchars($exception->getMessage()) .''; $xml .= ' '. htmlspecialchars($exception->getTraceAsString()) .''; $xml .= ' '; $xml .= ' '; $xml .= ''; return $xml; } }