예제 #1
0
 function to_xml($data)
 {
     return Converter::toXml($data);
 }
예제 #2
0
 /**
  * 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;
 }
예제 #3
0
 public function toXml($root = 'root')
 {
     return Converter::toXml($this->toArray(), $root);
 }