@@ 34-53 (lines=20) @@ | ||
31 | * |
|
32 | * @return DeliveryMethod |
|
33 | */ |
|
34 | public static function createFromXML(SimpleXMLElement $xml) |
|
35 | { |
|
36 | /* |
|
37 | <characteristic displayValue="Basic (0-500 EUR)" value="1" name="Insurance range code"/> |
|
38 | */ |
|
39 | $attributes = $xml->attributes(); |
|
40 | $children = $xml->children(); |
|
41 | ||
42 | $deliveryMethod = new self(); |
|
43 | $deliveryMethod->setName($attributes['name']); |
|
44 | $deliveryMethod->setVisibility($attributes['visiblity']); |
|
45 | ||
46 | if (isset($children->product)) { |
|
47 | foreach ($children->product as $productXml) { |
|
48 | $deliveryMethod->addProduct(Product::createFromXML($productXml)); |
|
49 | } |
|
50 | } |
|
51 | ||
52 | return $deliveryMethod; |
|
53 | } |
|
54 | ||
55 | /** |
|
56 | * @return string |
@@ 32-52 (lines=21) @@ | ||
29 | * |
|
30 | * @return Option |
|
31 | */ |
|
32 | public static function createFromXML(SimpleXMLElement $xml) |
|
33 | { |
|
34 | /* |
|
35 | <option visiblity="NOT_VISIBLE_BY_CONSUMER_OPTIONAL" price="0" name="Cash on delivery"/> |
|
36 | */ |
|
37 | $attributes = $xml->attributes(); |
|
38 | $children = $xml->children(); |
|
39 | ||
40 | $option = new self(); |
|
41 | $option->setVisibility($attributes['visiblity']); |
|
42 | $option->setPrice($attributes['price']); |
|
43 | $option->setName($attributes['name']); |
|
44 | ||
45 | if (isset($children->chracteristic)) { |
|
46 | foreach ($children->chracteristic as $characteristicXml) { |
|
47 | $option->addCharacteristic(Characteristic::createFromXML($characteristicXml)); |
|
48 | } |
|
49 | } |
|
50 | ||
51 | return $option; |
|
52 | } |
|
53 | ||
54 | /** |
|
55 | * @return string |