Example #1
0
 /**
  * @param SimpleXMLElement $xml
  *
  * @return Price
  */
 public static function createFromXML(SimpleXMLElement $xml)
 {
     /*
     <price price20To30="820" price10To20="720" price5To10="620" price2To5="520" priceLessThan2="420" countryIso2Code="BE"/>
     */
     $attributes = $xml->attributes();
     $price = new self();
     $price->setCountryIso2($attributes['countryIso2Code']);
     $price->setPriceLessThan2($attributes['priceLessThan2']);
     $price->setPrice2To5($attributes['price2To5']);
     $price->setPrice5To10($attributes['price5To10']);
     $price->setPrice10To20($attributes['price10To20']);
     $price->setPrice20To30($attributes['price20To30']);
     return $price;
 }