/** * @param CultureFeed_SimpleXMLElement $object * @return CultureFeed_Uitpas_Event_TicketSale_Opportunity */ public static function createFromXml(CultureFeed_SimpleXMLElement $object) { $opportunity = new CultureFeed_Uitpas_Event_TicketSale_Opportunity(); $opportunity->type = CultureFeed_Uitpas_Event_TicketSale_Opportunity::TYPE_DEFAULT; if (isset($object['type'])) { $opportunity->type = (string) $object['type']; } $opportunity->buyConstraintReason = $object->xpath_str('buyConstraintReason', FALSE); foreach ($object->xpath('priceClasses/priceClass') as $priceClass) { $opportunity->priceClasses[] = CultureFeed_Uitpas_Event_PriceClass::createFromXml($priceClass); } $couponElement = $object->xpath('ticketSaleCoupon', FALSE); if ($couponElement instanceof CultureFeed_SimpleXMLElement) { $opportunity->ticketSaleCoupon = CultureFeed_Uitpas_Event_TicketSale_Coupon::createFromXml($couponElement); } $remainingForEventElement = $object->xpath('remainingForEvent', FALSE); if ($remainingForEventElement instanceof CultureFeed_SimpleXMLElement) { $opportunity->remainingForEvent = CultureFeed_Uitpas_PeriodConstraint::createFromXml($remainingForEventElement); } $remainingTotalElement = $object->xpath('remainingTotal', FALSE); if ($remainingTotalElement instanceof CultureFeed_SimpleXMLElement) { $opportunity->remainingTotal = CultureFeed_Uitpas_PeriodConstraint::createFromXml($remainingTotalElement); } return $opportunity; }
public static function createFromXML(CultureFeed_SimpleXMLElement $object) { $distribution_key = new CultureFeed_Uitpas_DistributionKey(); $distribution_key->id = $object->xpath_int('id'); $distribution_key->name = $object->xpath_str('name'); $distribution_key->conditions = array(); foreach ($object->xpath('conditions/condition') as $condition) { $distribution_key->conditions[] = CultureFeed_Uitpas_DistributionKey_Condition::createFromXML($condition, FALSE); } foreach ($object->xpath('priceClasses/priceClass') as $priceClass) { $distribution_key->priceClasses[] = CultureFeed_Uitpas_Event_PriceClass::createFromXML($priceClass); } $distribution_key->tariff = $object->xpath_str('tariff'); $distribution_key->automatic = $object->xpath_bool('automatic'); $distribution_key->sameRegion = $object->xpath_bool('sameRegion'); return $distribution_key; }