function to_xml($data) { return Converter::toXml($data); }
/** * Format the response into the right content type. * * @param string $type * @return string */ protected function _format($type) { $response = array('success' => $this->_success, 'data' => $this->_data); if ($this->_code) { $response['code'] = $this->_code; } switch (strtolower($type)) { case 'json': $format = Converter::toJson($response); break; case 'xml': $format = Converter::toXml($response); break; case 'html': case 'text': default: $format = (string) $this->_data; break; } return $format; }
public function toXml($root = 'root') { return Converter::toXml($this->toArray(), $root); }