Beispiel #1
0
 /**
  * @see Drest\Writer\Writer::write()
  */
 public function write(ResultSet $data)
 {
     $this->xml = new \DomDocument('1.0', 'UTF-8');
     $this->xml->formatOutput = true;
     $dataArray = $data->toArray();
     if (key($dataArray) === 0) {
         // If there is no key, we need to use a default
         $this->xml->appendChild($this->convertArrayToXml('result', $dataArray));
     } else {
         $this->xml->appendChild($this->convertArrayToXml(key($dataArray), $dataArray[key($dataArray)]));
     }
     $this->data = $this->xml->saveXML();
 }
Beispiel #2
0
 /**
  * @see \DrestCommon\Representation\InterfaceRepresentation::write()
  */
 public function write(ResultSet $data)
 {
     $dataArray = $data->toArray();
     $this->formatData($dataArray);
     $this->data = json_encode($dataArray);
 }