30 if (func_num_args() == 0) {
44 'error' => Formatter::formatExceptionAsDataArray(
50 echo $this->
toXml($response);
62 assert(
'is_array($data) || $node instanceof Traversable');
64 foreach (
$data as $key => $value) {
65 if (is_numeric($key)) {
67 $key =
"unknownNode_". (string) $key;
71 $key = preg_replace(
'/[^a-z0-9\-\_\.\:]/i',
'', $key);
73 if (is_array($value)) {
74 $child = $node->addChild($key);
75 self::addDataToNode($child, $value);
77 $value = str_replace(
'&',
'&', print_r($value,
true));
78 $node->addChild($key, $value);
93 assert(
'is_array($data) || $node instanceof Traversable');
95 $node = simplexml_load_string(
"<?xml version='1.0' encoding='utf-8'?><root />");
97 return self::addDataToNode($node,
$data)->asXML();
Whoops - php errors for cool kids.
Catches an exception and converts it to an XML response.
Abstract implementation of a Handler.
static addDataToNode(\SimpleXMLElement $node, $data)
addTraceToOutput($returnFrames=null)
static toXml($data)
The main function for converting to an XML document.