예제 #1
0
파일: Obj2xml.php 프로젝트: huynp/Critical
 public static function transactionToXml($data, $type, $report_group)
 {
     $transac = simplexml_load_string("<{$type} />");
     if (Obj2xml::transactionShouldHaveReportGroup($type)) {
         $transac->addAttribute('reportGroup', $report_group);
     }
     Obj2xml::iterateChildren($data, $transac);
     return str_replace("<?xml version=\"1.0\"?>\n", "", $transac->asXML());
 }
예제 #2
0
 public static function transactionToXml($data, $type, $report_group)
 {
     $transac = simplexml_load_string("<{$type} />");
     if (Obj2xml::transactionShouldHaveReportGroup($type)) {
         $transac->addAttribute('reportGroup', $report_group);
         if (isset($data['id'])) {
             if ($data['id'] === "REQUIRED") {
                 throw new \InvalidArgumentException("Missing Required Field: id");
             } else {
                 $transac->addAttribute('id', $data["id"]);
             }
         }
         unset($data['id']);
     }
     Obj2xml::iterateChildren($data, $transac);
     return str_replace("<?xml version=\"1.0\"?>\n", "", $transac->asXML());
 }