コード例 #1
0
 public function init($arr = null)
 {
     if ($arr != null) {
         foreach ($arr as $arry) {
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'name') {
                 $this->Name = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'number') {
                 $this->Number = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'quantity') {
                 $this->Quantity = $arry["text"];
             }
             if (is_array($arry["attributes"]) && $arry["attributes"] != null) {
                 if ($arry["name"] == 'tax') {
                     $tmp = array();
                     $atr = array();
                     foreach ($arry["attributes"] as $key => $val) {
                         $atr[0]["name"] = $key;
                         $atr[0]["text"] = $val;
                     }
                     $atr[1]["name"] = "value";
                     $atr[1]["text"] = $arry["text"];
                     $this->Tax = new BasicAmountType();
                     $this->Tax->init($atr);
                 }
             }
             if (is_array($arry["attributes"]) && $arry["attributes"] != null) {
                 if ($arry["name"] == 'amount') {
                     $tmp = array();
                     $atr = array();
                     foreach ($arry["attributes"] as $key => $val) {
                         $atr[0]["name"] = $key;
                         $atr[0]["text"] = $val;
                     }
                     $atr[1]["name"] = "value";
                     $atr[1]["text"] = $arry["text"];
                     $this->Amount = new BasicAmountType();
                     $this->Amount->init($atr);
                 }
             }
             if (is_array($arry["children"]) && $arry["children"] != null) {
                 if ($arry["name"] == 'ebayitempaymentdetailsitem') {
                     $this->EbayItemPaymentDetailsItem = new EbayItemPaymentDetailsItemType();
                     $this->EbayItemPaymentDetailsItem->init($arry["children"]);
                 }
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'promocode') {
                 $this->PromoCode = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'productcategory') {
                 $this->ProductCategory = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'description') {
                 $this->Description = $arry["text"];
             }
             if (is_array($arry["attributes"]) && $arry["attributes"] != null) {
                 if ($arry["name"] == 'itemweight') {
                     $tmp = array();
                     $atr = array();
                     foreach ($arry["attributes"] as $key => $val) {
                         $atr[0]["name"] = $key;
                         $atr[0]["text"] = $val;
                     }
                     $atr[1]["name"] = "value";
                     $atr[1]["text"] = $arry["text"];
                     $this->ItemWeight = new MeasureType();
                     $this->ItemWeight->init($atr);
                 }
             }
             if (is_array($arry["attributes"]) && $arry["attributes"] != null) {
                 if ($arry["name"] == 'itemlength') {
                     $tmp = array();
                     $atr = array();
                     foreach ($arry["attributes"] as $key => $val) {
                         $atr[0]["name"] = $key;
                         $atr[0]["text"] = $val;
                     }
                     $atr[1]["name"] = "value";
                     $atr[1]["text"] = $arry["text"];
                     $this->ItemLength = new MeasureType();
                     $this->ItemLength->init($atr);
                 }
             }
             if (is_array($arry["attributes"]) && $arry["attributes"] != null) {
                 if ($arry["name"] == 'itemwidth') {
                     $tmp = array();
                     $atr = array();
                     foreach ($arry["attributes"] as $key => $val) {
                         $atr[0]["name"] = $key;
                         $atr[0]["text"] = $val;
                     }
                     $atr[1]["name"] = "value";
                     $atr[1]["text"] = $arry["text"];
                     $this->ItemWidth = new MeasureType();
                     $this->ItemWidth->init($atr);
                 }
             }
             if (is_array($arry["attributes"]) && $arry["attributes"] != null) {
                 if ($arry["name"] == 'itemheight') {
                     $tmp = array();
                     $atr = array();
                     foreach ($arry["attributes"] as $key => $val) {
                         $atr[0]["name"] = $key;
                         $atr[0]["text"] = $val;
                     }
                     $atr[1]["name"] = "value";
                     $atr[1]["text"] = $arry["text"];
                     $this->ItemHeight = new MeasureType();
                     $this->ItemHeight->init($atr);
                 }
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'itemurl') {
                 $this->ItemURL = $arry["text"];
             }
             if (is_array($arry["children"]) && $arry["children"] != null) {
                 if ($arry["name"] == 'enhanceditemdata') {
                     $this->EnhancedItemData = new EnhancedItemDataType();
                     $this->EnhancedItemData->init($arry["children"]);
                 }
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'itemcategory') {
                 $this->ItemCategory = $arry["text"];
             }
         }
     }
 }